How To Install New Relic APM On Ubuntu
New Relic APM on Ubuntu helps Magento 2 developers and store owners monitor performance, track slow transactions, and optimize PHP applications in real time. In this guide, you’ll learn how to install New Relic APM on Ubuntu using the official package repository for a clean and reliable setup.
Steps To Install New Relic APM On Ubuntu
Step 1: Update and Prepare Your Ubuntu Environment
Before installing New Relic, make sure your Ubuntu packages are up to date.
sudo apt update && sudo apt upgrade -y

💡 Tip: A clean and updated environment helps avoid dependency conflicts during installation.
Step 2: Add the New Relic Repository and GPG Key
New Relic provides an official APT repository for Linux systems.
Add the GPG key and repository with these commands:
wget -O- https://download.newrelic.com/NEWRELIC_APT_2DAD550E.public | sudo gpg --dearmor -o /usr/share/keyrings/newrelic-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/newrelic-archive-keyring.gpg] http://apt.newrelic.com/debian/ newrelic non-free" | sudo tee /etc/apt/sources.list.d/newrelic.list
sudo apt update

This command installs both the New Relic CLI and the PHP agent used to monitor your web applications.
Step 3: Install the New Relic PHP Agent
Now, install the PHP agent that will monitor your Magento 2 store:
sudo apt install newrelic-php5

This will install the required dependencies and PHP extension automatically.
Step 4: Configure Your License Key and Application Name
During installation, New Relic asks for a license key and an application name.
If you haven’t created your account or don’t know where to find these values, follow this guide first:
How to Find New Relic License Key and App Name

Step 5: Run the Installation Script
After installation, run the New Relic installer script to enable the PHP agent:
sudo newrelic-install install
This automatically detects your PHP version and configures the extension.
Step 6: Restart PHP and Your Web Server
To apply changes, restart PHP-FPM and Nginx (or Apache, depending on your setup):
sudo systemctl restart php8.x-fpm
sudo systemctl restart nginx
If you use Apache:
sudo systemctl restart apache2
Step 7: Verify the Installation
Run this command to confirm the New Relic extension is active:
php -m | grep newrelic

You should see newrelic in the output list.
Then, go to your New Relic dashboard → APM → Applications, and your Magento 2 site should appear within a few minutes.
Conclusion
That’s it! You’ve successfully installed New Relic APM on Ubuntu for your Magento 2 store.
This setup gives you powerful insights into application performance, database queries, and slow transactions — essential for high-traffic eCommerce sites.
In the next tutorial, learn how to use New Relic APM with Magento 2 for advanced monitoring and performance optimization.