Skip to content

How do I install Nanitor Agent on Linux/BSD/Mac?

For the Windows operating system see How do I install/distribute the Nanitor Agent on Windows?

Preparing

First, decide if you want to download the installation files ahead of time and distribute them to the systems in question or if you want to download the Nanitor agent directly onto the system in question. Here are the instructions for downloading the agent ahead of time. If you are going to download the installation files directly, you'll need to fetch your signup URL here.

Quickest option: one-line install (Linux and macOS)

The Nanitor portal shows a one-line install command for Linux and macOS under Agent installers, with your signup URL already filled in. The command downloads the latest agent, installs it, signs it up and starts it. It must run as root, so add sudo in front of the command you copy from the portal:

sudo SIGNUP_URL="<signup-url>" /bin/bash -c "$(curl -fsSL https://nanitor.io/files/installers/install-linux.sh)"
sudo SIGNUP_URL="<signup-url>" /bin/bash -c "$(curl -fsSL https://nanitor.io/files/installers/install-osx.sh)"

Use the manual steps below if you need a proxy, your distribution uses neither yum nor apt (for example SUSE), the client cannot download from the internet, or you want to distribute the packages yourself.

Proxy configuration

If you want to configure a proxy on the agent during the setup process you should do so before you signup the agent, regardless of which path you choose below. Here is an example of Ubuntu using path B.

sudo apt install ./nanitor-agent.deb
sudo /opt/nanitor-agent/bin/nanitor-agent proxy-set user:[email protected]:1234
sudo /opt/nanitor-agent/bin/nanitor-agent signup --key <signup-url>
sudo systemctl restart nanitor-agent

proxy.company.com is the FQDN of the proxy you need to use, 1234 is the port the proxy is using (often it is 8080) and user/Password is the authentication for the Proxy. If the Proxy requires no authentication then you leave that off and it becomes

sudo apt install ./nanitor-agent.deb
sudo /opt/nanitor-agent/bin/nanitor-agent proxy-set proxy.company.com:1234
sudo /opt/nanitor-agent/bin/nanitor-agent signup --key <signup-url>
sudo systemctl restart nanitor-agent

For more details see the Agent proxy setup guide

Installation

Note

Before installing, verify that your operating system meets the minimum version requirements. For older operating systems, see the Legacy OS agent support section.

Restart the agent after signup on Linux

The Linux packages start the agent service during installation, before it is signed up. An agent that is not signed up stays idle until the service is restarted, so always restart the service after running signup. Running start is not enough, because the service is already running.

Path A: Download the agent first and distribute it to the client

Download the agent zip file for your platform from the Nanitor portal and copy it to the client. The zip file contains the installation package and a signup-url.txt file with your signup URL. It also contains a signup-key.txt file, which you can ignore for these steps. Replace <downloaded-zip> with the name of your zip file, and run the commands from the directory where you copied it (for example /tmp).

unzip <downloaded-zip>.zip
sudo yum install ./nanitor-agent-*.rpm
sudo /opt/nanitor-agent/bin/nanitor-agent signup --key `cat signup-url.txt`
sudo systemctl restart nanitor-agent
sudo systemctl status nanitor-agent
unzip <downloaded-zip>.zip
sudo apt install ./nanitor-agent*.deb
sudo /opt/nanitor-agent/bin/nanitor-agent signup --key `cat signup-url.txt`
sudo systemctl restart nanitor-agent
sudo systemctl status nanitor-agent
unzip <downloaded-zip>.zip
sudo yum install ./nanitor-agent-*.rpm
sudo /opt/nanitor-agent/bin/nanitor-agent signup --key `cat signup-url.txt`
sudo /opt/nanitor-agent/bin/nanitor-agent-ctl restart
sudo /opt/nanitor-agent/bin/nanitor-agent-ctl status
unzip <downloaded-zip>.zip
sudo apt install ./nanitor-agent*.deb
sudo /opt/nanitor-agent/bin/nanitor-agent signup --key `cat signup-url.txt`
sudo /opt/nanitor-agent/bin/nanitor-agent-ctl restart
sudo /opt/nanitor-agent/bin/nanitor-agent-ctl status
cd /tmp
mkdir -p /etc/signify
ftp -o /etc/signify/nanitor-agent-pkg.pub https://nanitor.io/files/certs/nanitor-agent-openbsd.pub
unzip nanitor-agent-<version>_openbsd_amd64_tgz.zip
mv nanitor-agent-<version>_openbsd_amd64.tgz nanitor-agent-<version>.tgz
pkg_add ./nanitor-agent-<version>.tgz
/usr/local/bin/nanitor-agent-bin signup --key `cat signup-url.txt`
rcctl start nanitor_agent
rcctl enable nanitor_agent
unzip <downloaded-zip>.zip
pkg install ./nanitor-agent-*.txz
/usr/local/bin/nanitor-agent-bin signup --key `cat signup-url.txt`
service nanitor_agent enable
service nanitor_agent start
service nanitor_agent status

Keep signup-url.txt in the same folder as the .pkg file. The installer reads it and signs up the agent automatically. Unzip into /tmp and run the installer from there, then check the result with the verify command below.

cd /tmp
unzip <downloaded-zip>.zip
sudo installer -pkg ./nanitor-agent*.pkg -target /Library/

Path B: Download the agent from the client

This is a bit simpler approach as there is no prep work other than grabbing the signup URL and then open up a terminal or a shell on the client. Make sure you replace <signup-url> with your actual signup URL

sudo yum install https://nanitor.io/agents/nanitor-agent-latest.x86_64.rpm
sudo /opt/nanitor-agent/bin/nanitor-agent signup --key <signup-url>
sudo systemctl restart nanitor-agent
sudo systemctl status nanitor-agent   
cd /tmp
sudo curl -o nanitor-agent.deb https://nanitor.io/agents/nanitor-agent-latest_amd64.deb
sudo apt install ./nanitor-agent.deb 
sudo /opt/nanitor-agent/bin/nanitor-agent signup --key <signup-url>
sudo systemctl restart nanitor-agent
sudo systemctl status nanitor-agent
sudo yum install https://nanitor.io/agents/nanitor-agent-latest.x86_64.rpm
sudo /opt/nanitor-agent/bin/nanitor-agent signup --key <signup-url>
sudo /opt/nanitor-agent/bin/nanitor-agent-ctl restart
sudo /opt/nanitor-agent/bin/nanitor-agent-ctl status
cd /tmp
sudo curl -o nanitor-agent.deb https://nanitor.io/agents/nanitor-agent-latest_amd64.deb
sudo apt install ./nanitor-agent.deb 
sudo /opt/nanitor-agent/bin/nanitor-agent signup --key <signup-url>
sudo /opt/nanitor-agent/bin/nanitor-agent-ctl restart
sudo /opt/nanitor-agent/bin/nanitor-agent-ctl status
cd /tmp
ftp -o /etc/signify/nanitor-agent-pkg.pub https://nanitor.io/files/certs/nanitor-agent-openbsd.pub
ftp https://nanitor.io/agents/nanitor-agent-latest_openbsd_amd64.tgz
ftp https://nanitor.io/agents/nanitor-agent-latest-buildinfo.json
nanitor_version=$(awk -F'"' '/version/{print $4}' nanitor-agent-latest-buildinfo.json)
mv nanitor-agent-latest_openbsd_amd64.tgz nanitor-agent-${nanitor_version}.tgz
pkg_add ./nanitor-agent-${nanitor_version}
/usr/local/bin/nanitor-agent signup --key <signup-url>
rcctl start nanitor_agent
rcctl enable nanitor_agent
cd /tmp
curl -o nanitor-agent.txz https://nanitor.io/agents/nanitor-agent-latest_freebsd_amd64.txz
pkg install ./nanitor-agent.txz
/usr/local/bin/nanitor-agent-bin signup --key <signup-url>
service nanitor_agent enable
service nanitor_agent start
service nanitor_agent status

The installer signs up the agent automatically when a signup-url.txt file is in the same folder as the .pkg file.

cd /tmp
curl -o nanitor-agent-latest_osx64.pkg https://nanitor.io/agents/nanitor-agent-latest_osx64.pkg
echo "<signup-url>" > signup-url.txt
sudo installer -pkg ./nanitor-agent-latest_osx64.pkg -target /Library/

Verify the installation

Check that the agent is signed up and connected:

sudo /opt/nanitor-agent/bin/nanitor-agent info --status
sudo "/Library/Nanitor/Nanitor Agent/nanitor-agent" info --status

The asset usually appears in the asset list in the Nanitor portal within a few minutes. Its health shows P (pending) until the asset has a health score.