Install Infrastructure agent for Linux

With Infrastructure for Linux, you can monitor not only individual servers, but understand how your service performs as a whole. Infrastructure supports Amazon Linux, CentOS, Debian, RHEL, and Ubuntu as well as Windows Server. Before installation, review the Compatibility and requirements.

To install Infrastructure with a configuration management tool, see the documentation on Ansible, Chef, and Puppet. For Docker, see Docker instrumentation.

Install the Infrastructure agent

The hostname for your server cannot be "localhost." Data will not be reported for servers with that name. The host name should be a unique name.

To install the agent, follow the instructions for your package manager:

To install the Infrastructure agent on Debian:

  1. Review the agent requirements and supported operating systems for 64-bit architectures.

  2. Create a configuration file, and add your license key:

    echo "license_key: YOUR_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml
    
  3. Enable New Relic's GPG key:

    curl -s https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add -
  4. Determine the distribution version number:

    cat /etc/os-release
    
  5. Create the agent's apt repo using the command for your distribution version:

    Debian 7 ("Wheezy")
    printf "deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt wheezy main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
    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
  6. Update your apt cache:

    sudo apt-get update
  7. Run the install script:

    sudo apt-get install newrelic-infra -y

Wait a few minutes, then view your hosts in the Infrastructure UI. If no data appears after waiting a few minutes, see No data appears.

To install the Infrastructure agent on Ubuntu:

  1. Review the agent requirements and supported operating systems for 64-bit architectures.

  2. Create a configuration file, and add your license key:

    echo "license_key: YOUR_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml
    
  3. Enable New Relic's GPG key:

    curl https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add -
  4. Determine the distribution version number:

    cat /etc/lsb-release
    
  5. Create the agent's apt repo using the command for your distribution version:

    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
  6. Update your apt cache:

    sudo apt-get update
  7. Run the install script:

    sudo apt-get install newrelic-infra -y

Wait a few minutes, then view your hosts in the Infrastructure UI. If no data appears after waiting a few minutes, see No data appears.

To install the Infrastructure agent on Amazon Linux, CentOS, or RHEL (Red Hat Enterprise Linux):

  1. Review the agent requirements and supported operating systems for 64-bit architectures.

  2. Create a configuration file, and add your license key:

    echo "license_key: YOUR_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml
  3. Determine the distribution version number:

    cat /etc/os-release
    
  4. Create the agent's yum repo:

    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 5, RHEL 5
    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, RHEL 6
    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, RHEL 7
    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
    
  5. Update your yum cache:

    sudo yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
  6. Run the install script:

    sudo yum install newrelic-infra -y

Wait a few minutes, then view your server in the Infrastructure UI. If no data appears after waiting a few minutes, see No data appears.

To install the Infrastructure agent on SLES (SUSE Linux Enterprise Server):

  1. Review the agent requirements and supported operating systems for 64-bit architectures.

  2. Create a configuration file, and add your license key:

    echo "license_key: YOUR_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml
  3. Determine the distribution version number:

    cat /etc/os-release | grep VERSION_ID
    
  4. Import the New Relic GPG key:

    sudo rpm --import https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg
  5. Create the agent's Zypper repo:

    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
    
  6. Update your Zypper repos:

    sudo zypper -n ref -r newrelic-infra
  7. Run the install script:

    sudo zypper -n install newrelic-infra

Wait a few minutes, then view your server in the Infrastructure UI. If no data appears after waiting a few minutes, see No data appears.

What's next?

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

Update the agent

To upgrade to the latest version, see Update the Infrastructure agent.

For more help

Recommendations for learning more: