Using a tool to monitor device status and conditions is not new stuff to learn. The only limitation of the conventional PC monitoring tools is, they only monitor what is on the policy, whereas the New Relic Infrastructure monitors the deep down structures, log analysis, and parameters. It measures dynamic host data, live data for both hardware-level and software level parameters. It can notify you before any components are gone broke. You can monitor every layer of your application and optimize performance. Deploying the Relic infrastructure agent is easy and straightforward for any Linux, Mac, and Windows.
New Relic Infrastructure Agent in Linux
The New Relic infrastructure agent is an open-source tool that is fully compatible with Linux. There are different methods to install the Relic agent on Linux, and it also allows you to compile and build the Relic tool on your Linux machine. Installing the New Relic Infrastructure agent on a Linux system requires a 64-bit architecture version and a unique host-name of your machine.
Here, we will use Ubuntu, Fedora workstation, and the SUSE Linux Enterprise to demonstrate the method of installing the New Relic Infrastructure agent on a Linux system.
Step 1: Add the New Relic License Key
At the very beginning of installing the New Relic Infrastructure agent on your Linux machine, you need to add the New Relic license key on your machine. Adding the license key requires only one command, which works for all major Linux distributions. Please run the following Echo command on your terminal shell with root privilege to load the license key string on your system.
echo "license_key: YOUR_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml
You may now check your system’s version when the key is pulled to ensure that your system supports the New Relic infrastructure agent.
Use the following commands accordingly on your terminal shell to find out the system version on your Linux machine.
- See version on Ubuntu/Debian
cat /etc/os-release
- Find out the version on Fedora/Red Hat Linux
cat /etc/os-release
- Find Out the version on SUSE Linux Enterprise
cat /etc/os-release | grep VERSION_ID
Step 2: Enable New Relic’s GPG Key
Installing the GPG key on Linux will help the default package manager recognize the Relic key as a source. In this stage, we will need to download and enable the GNU privacy key of the New Relic Infrastructure agent on our Linux system. Since we are using the cURL tool to download the GPG key, please ensure that the cURL tool is installed on your Linux system.
- Get The GPG Key on Ubuntu/Debian
curl -s https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add -
- Download The GPG Key on SUSE Linux Enterprise
curl https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg -s | sudo gpg --import
If you’re using a Fedora workstation, probably your system already has the updated GNU privacy key installed on your Linux system.
Step 3: Add Relic Repository on Linux
After importing the GPG key on your Linux computer, it’s time to add the New Relic repository on your system to install the Relic Infrastructure Agent In Linux. The following commands will lead you to get the Relic repository on your system.Â
- Execute the following command to get the Relic Repo on Ubuntu/Debian
printf "deb https://download.newrelic.com/infrastructure_agent/linux/apt focal main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
- Perform the following command to get the Relic Repo on Fedora/Red Hat Linux
sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/8/aarch64/newrelic-infra.repo
- Run the following command to get the Relic Repo on SUSE Linux Enterprise
sudo curl -o /etc/zypp/repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/zypp/sles/12.1/x86_64/newrelic-infra.repo
Step 4: Refresh the Repositories
Reloading the system cache and repositories is important, and it’s easy. Here, I’m showing the particular commands to load the repositories on Linux, mostly for new Relic repositories. When you update the repository, make sure that the New Relic agent repository loads and gets updated.
- Load the System Repository on Ubuntu/Debian
sudo apt-get update
On Fedora, there are commands to load and refresh the system repository, which are given below. You may also need to execute the specific command to refresh the Relic repository.
- Refresh Repository on Fedora/Red Hat Linux
sudo yum update sudo yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
- Update System repository on SUSE Linux Enterprise
sudo zypper -n ref -r newrelic-infra
Step 5: Install the New Relic Agent on Linux Desktop
Finally, we are at the end of this post, where we see the commands to install the New Relic Infrastructure Agent In Linux. If you’ve done the previous steps correctly, you can execute the following commands on your terminal shell with root access according to your Linux distribution.
- Install Relic Infrastructure Agent on Ubuntu/Debian
sudo apt-get install libcap2-bin sudo apt-get install newrelic-infra -y
- Install Relic Infrastructure Agent on Fedora/Red Hat Linux
sudo yum install newrelic-infra -y
- Get Relic Infrastructure Agent In Linux on SUSE Linux Enterprise
sudo zypper -n install newrelic-infra
Remove Relic Infrastructure Agent In Linux
Uninstalling the Relic Infrastructure Agent In Linux is easy, and it’s maintained by just a single command. You can run the following commands below according to your distribution to remove the Relic agent from your Linux system.
- Remove Relic Infrastructure Agent on Ubuntu/Debian
sudo apt-get remove newrelic-infra
- Uninstall The Relic Infrastructure Agent In Fedora
sudo yum remove newrelic-infra
- Remove Relic Infrastructure Agent In SuSE Linux
sudo zypper -n remove newrelic-infra
Extra Tip: Update the New Relic Agent
Sometimes, using the default methods might end up installing an older version of Relic agent on your Linux machine. To solve this issue, you can update the Relic agent on your system.
If you already have the Relic Agent installed on your Linux system, you might want to update the current Relic agent. You can just run the suitable command for your distribution from the commands given below.
- Update Relic Agent on Debian/Ubuntu Linux
sudo apt-get update && sudo apt-get install --only-upgrade newrelic-infra -y
- Upgrade Relic Agent on Fedora/Red Hat Linux
sudo yum update newrelic-infra -y
- Update Relic Agent on SuSE Linux
sudo zypper -n update newrelic-infra
Final Words
Installing the Relic Infrastructure Agent in Linux was not a hard task; we can now start the Relic agent and make integrations with the host system for enhanced monitoring. Please be careful while installing; make sure you run the root commands if you’re a root user and run the privileged root command if you’re a privileged user. In the entire post, we have seen methods to install the New Relic Infrastructure Agent In Linux.
Please share this post with your friends and the Linux community if you find it helpful and handy. You can also write down your opinions regarding this post in the comment section.