Working with numerous clients to resolve performance issues in their WordPress sites, New Relic has been a steadfast ally, aiding me in monitoring performance and gathering vital insights to enhance site speed and functionality. While New Relic proves invaluable during the debugging phase, there comes a a time when a thorough cleanup is needed, especially after you’ve concluded the monitoring and debugging phases. The process might appear complex due to the fragmented documentation, but rest assured, this guide will help you ensures no traces are left behind.
Step 1: Stop the New Relic PHP Agent services:
- To prevent further data collection, begin by stopping the New Relic PHP agent and the infrastructure agent that is usually automatically added during the installation process.
sudo service newrelic-daemon stop
sudo service newrelic-infra stop
- Use the “purge” command of your package manager to uninstall New Relic PHP and Infrastructure agents, to ensure removal of configuration files as well.
sudo apt purge newrelic-php5
sudo apt purge newrelic-infra
- Run the package manager’s “autoremove” to remove any remaining dependencies that were installed along with New Relic.
sudo apt autoremove
Step 2: Clean Up Configuration, Package Manager Files, and Residual Traces:
- Start by deleting the New Relic PHP configuration file hiding in the PHP configuration directory.
sudo rm /etc/php/<PHP_VERSION>/mods-available/newrelic.ini
- If you’re using a package manager like
apt, consider removing New Relic’s files specific to the manager. Use the following commands based on your system’s architecture.
For 32-bit systems:
sudo dpkg -P newrelic-php5-common_X.X.X.X (YOUR VERSION NUMBER)_all.deb newrelic-daemon_X.X.X.X_i386.deb newrelic-php5_X.X.X.X_i386.deb
For 64-bit systems:
sudo dpkg -P newrelic-php5-common_X.X.X.X (YOUR VERSION NUMBER)_all.deb newrelic-daemon_X.X.X.X_amd64.deb newrelic-php5_X.X.X.X_amd64.deb
- Run the command
sudo find / -name "*newrelic*"to search the entire system for any New Relic-related traces. Review the results and, if necessary, use
sudo rmto eliminate any remaining files or directories.
Step 3: Restart Web Server:
- If you’re using Apache, Nginx, or PHP-FPM, it’s time for a restart so the changes take effect.
sudo service apache2 restart
sudo service nginx restart
sudo service php<PHP_VERSION>-fpm restart
That’s it, as we part ways with New Relic’s installation, your server’s space gets a little tidier. This simple process ensures that every bit of New Relic is wiped off your Ubuntu system. Although guides might be scattered, this method is straightforward. You can confidently say goodbye to any remaining traces.