Install the infrastructure agent for Linux using the package manager

Our infrastructure agent for Linux can be installed using several package managers.

Before installation, make sure to:

Install the agent using our wizard

To install the infrastructure agent, click the button for your Linux distribution and follow the instructions:

Amazon Linux
Amazon Linux
CentOS
CentOS
CoreOS
CoreOS
Debian
Debian
Red Hat
RHEL
SLES
SLES
Ubuntu
Ubuntu
Other Linux OS
Other Linux distros

To use the links above, you must be logged to your New Relic account.

If you don't have a New Relic account yet, or prefer to follow the procedure manually, see our step-by-step tutorial in the next section.

To install the infrastructure agent in Linux, follow these instructions:
  1. Create the configuration file and add your license key:
    echo "license_key: YOUR_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml
  2. Determine the distribution version number:
    Debian.png Debian
    cat /etc/os-release
    ubuntu icon Ubuntu
    cat /etc/lsb-release
    amazon linux.png Amazon Linux, centos icon CentOS, redhat icon RHEL
    cat /etc/os-release
    suse icon SLES
    cat /etc/os-release | grep VERSION_ID
  3. Enable New Relic's GPG key.
    Debian.png Debian
    curl -s https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add -
    ubuntu icon Ubuntu
    curl -s https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add -
    amazon linux.png Amazon Linux, centos icon CentOS, redhat icon RHEL

    yum automatically installs the GPG key using the value in gpgkey.

    suse icon SLES
    curl https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg -s | sudo gpg --import
    
  4. Add the infrastructure agent repository:
    Debian.png Debian
    Debian 8 ("Jessie")
    printf "deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt jessie main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
    Debian 9 ("Stretch")
    printf "deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt stretch main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
    Debian 10 ("Buster")
    printf "deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt buster main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
    ubuntu icon Ubuntu
    Ubuntu 12 ("Precise")
    printf "deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt precise main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
    Ubuntu 14 ("Trusty")
    printf "deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt trusty main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
    Ubuntu 16 ("Xenial")
    printf "deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt xenial main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
    Ubuntu 18 ("Bionic")
    printf "deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt bionic main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
    amazon linux.png Amazon Linux
    Amazon Linux
    sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/6/x86_64/newrelic-infra.repo
    Amazon Linux 2
    sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/7/x86_64/newrelic-infra.repo
    centos icon CentOS / redhat icon RHEL
    CentOS 5.x, RHEL 5.x
    sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/5/x86_64/newrelic-infra.repo
    CentOS 6.x, RHEL 6.x
    sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/6/x86_64/newrelic-infra.repo
    CentOS 7.x, RHEL 7.x
    sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/7/x86_64/newrelic-infra.repo
    CentOS 8.x, RHEL 8.x
    sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/8/x86_64/newrelic-infra.repo
    suse icon SLES
    SLES 11.4
    sudo curl -o /etc/zypp/repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/zypp/sles/11.4/x86_64/newrelic-infra.repo
    SLES 12.1
    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 
    SLES 12.2
    sudo curl -o /etc/zypp/repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/zypp/sles/12.2/x86_64/newrelic-infra.repo 
    SLES 12.3
    sudo curl -o /etc/zypp/repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/zypp/sles/12.3/x86_64/newrelic-infra.repo 
    SLES 12.4
    sudo curl -o /etc/zypp/repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/zypp/sles/12.4/x86_64/newrelic-infra.repo  
  5. Refresh the repositories:
    Debian.png Debian
    sudo apt-get update
    ubuntu icon Ubuntu
    sudo apt-get update
    amazon linux.png Amazon Linux, centos icon CentOS, redhat icon RHEL
    sudo yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
    suse icon SLES
    sudo zypper -n ref -r newrelic-infra
  6. Install the newrelic-infra package in root (default), privileged user, or unprivileged user mode. For more information on each running mode, see Linux agent running modes.

    Root (default)
    • Debian.png Debian and ubuntu icon Ubuntu:
      sudo apt-get install newrelic-infra -y
    • amazon linux.png Amazon Linux, centos icon CentOS, redhat icon RHEL:
      sudo yum install newrelic-infra -y
    • suse icon SLES:
      sudo zypper -n install newrelic-infra
    Privileged user

    Install the libcap library and set the NRIA_MODE environment variable to PRIVILEGED.

    • Debian.png Debian and ubuntu icon Ubuntu:
      sudo apt-get install libcap2-bin
      sudo NRIA_MODE="PRIVILEGED" apt-get install newrelic-infra
    • amazon linux.png Amazon Linux, centos icon CentOS, redhat icon RHEL:
      sudo yum install libcap
      sudo NRIA_MODE="PRIVILEGED" yum install newrelic-infra
    • suse icon SLES:
      sudo zypper install libcap-progs
      sudo NRIA_MODE="PRIVILEGED" zypper install newrelic-infra
    Unprivileged user

    Install the libcap library and set the NRIA_MODE environment variable to UNPRIVILEGED.

    • Debian.png Debian and ubuntu icon Ubuntu:
      sudo apt-get install libcap2-bin
      sudo NRIA_MODE="UNPRIVILEGED" apt-get install newrelic-infra
    • amazon linux.png Amazon Linux, centos icon CentOS, redhat icon RHEL:
      sudo yum install libcap
      sudo NRIA_MODE="UNPRIVILEGED" yum install newrelic-infra
    • suse icon SLES:
      sudo zypper install libcap-progs
      sudo NRIA_MODE="UNPRIVILEGED" zypper install newrelic-infra

Once the agent is installed or updated, you can start, stop, or check the infrastructure agent status.

As of version 1.4.0, the infrastructure agent package includes the additional newrelic-infra-ctl binary, which is used to help troubleshoot a running agent. Although this binary is not required to execute the agent, we recommend to add it in your path.

Install using configuration management tools

To install the infrastructure agent with a configuration management tool, see the documentation for:

Install for Docker containers on instrumented hosts

See Docker instrumentation for Infrastructure monitoring.

Install using tarball files

For custom setup scenarios, you can install the agent using our tarball files in assisted or manual modes.

This is especially useful when you need to adapt the default installation settings to your environment, or to install the infrastructure agent on distributions that lack the newrelic-infra package in their repositories.

Installing the agent using tarball files is officially supported only for the AWS Graviton 2 processor.

Update the agent

Follow standard procedures to update the infrastructure agent.

If you are using sudo to install or update the agent, use the -E argument to allow bypassing the environment variables, or specify the NRIA_MODE environment variable just after sudo.

export NRIA_MODE="SET_MODE_HERE"

OR

sudo -E YOUR_PACKAGE_MANAGER_UPDATE_COMMAND

What's next?

Generate some traffic and wait a few minutes, then view your hosts in the Infrastructure monitoring UI. If no data appears after waiting a few minutes, see No data appears.

The only required configuration option is the license_key setting, which is created as part of the installation procedures. You may also want to:

The hostname for your server cannot be localhost. Data will not be reported for servers with that name. Make sure the host name uses a unique name.

For more help

If you need more help, check out these support and learning resources: