In this guide we will install Nagios 4 on Debian 10 (Buster) Linux. Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. It monitors your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. In the event of a failure, Nagios can alert the technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers.

Nagios® Core™ is an Open Source system and network monitoring application. It watches hosts and services that you specify, alerting you when things go bad and when they get better.

If you would wish to install Nagios Core on Debian 10, the following steps will help you rev it up in a few minutes.

Step 1: Update your System

Run the command below to update your server so that we begin from latest software installed

sudo apt update

If it is a totally new server, follow this guide to update your apt sources file (/etc/apt/sources.list)

Step 2: Install the required packages

The following step will install the pre-requisite packages that Nagios Core needs to run. Please proceed to install them.

sudo apt install vim wget curl build-essential unzip openssl libssl-dev apache2 php libapache2-mod-php php-gd libgd-dev

Step 3: Fetch and extract Nagios Files

We now have to go to the Nagios downloads page to grab the latest release.

cd ~
export VER="4.4.6"

Extract the tarball

tar xvzf nagios-$VER.tar.gz

Step 4: Compile the extracted files

After Nagios core files have been successfully extracted, navigate into the new directory holding the files and begin the compilation process.

cd nagios-$VER
./configure --with-httpd-conf=/etc/apache2/sites-enabled

You should see the following when the above command ends.

*** Configuration summary for nagios 4.4.6 2020-04-28 ***:
 General Options:
     Nagios executable:  nagios     Nagios user/group:  nagios,nagios    Command user/group:  nagios,nagios          Event Broker:  yes     Install ${prefix}:  /usr/local/nagios Install ${includedir}:  /usr/local/nagios/include/nagios             Lock file:  /run/nagios.lock
 Check result directory:  /usr/local/nagios/var/spool/checkresults
            Init directory:  /lib/systemd/system
   Apache conf.d directory:  /etc/apache2/sites-enabled
              Mail program:  /bin/mail
                   Host OS:  linux-gnu
           IOBroker Method:  epoll
 Web Interface Options:
              HTML URL:  http://localhost/nagios/               CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):  /usr/bin/traceroute

Step 5: Create User And Group

This step ensures that “nagios” user and group are created. The www-data user is also added to the “nagios” group.

sudo make install-groups-users
sudo usermod -a -G nagios www-data

Now let us compile the main Nagios program and associated packages

sudo make all

Install the main program, CGIs, and HTML files

sudo make install

Step 6: Install Daemon

This installs Nagios daemon files and also configures them to start when the system boots.

sudo make install-daemoninit

Step 7: Add Command Mode

This installs and configures the external command file.

sudo make install-commandmode

Step 8: Install Configuration Files

In this step, we install SAMPLE configuration files required as Nagios needs some configuration files to allow it to start.

sudo make install-config

Step 9: Apache Webserver Configuration

We have to configure our Apache to serve Nagios web pages. Nagios developers made it easier to set up Apache. You simply run one command to set up configuration files and then enable specific apache modules. Proceed as below.

This will install config files

sudo make install-webconf

This enables Apache rewrite and CGI modules

sudo a2enmod rewrite cgi

Step 10: Configure Nagios Apache Authentication

In order to create Nagios Web authentication, you need to create a web user for authentication. The “htpasswd” command rises to the occasion for this task. Please note that Nagios uses “nagiosadmin” user by default. Run the command below and input your favorable password.

sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

After that, give appropriate permissions to the (/usr/local/nagios/etc/htpasswd.users) file.

sudo chown www-data:www-data /usr/local/nagios/etc/htpasswd.users
sudo chmod 640 /usr/local/nagios/etc/htpasswd.users

Step 11: Install essential Nagios Plugins

Before we finish up setting up our Nagios core monitoring, we need Nagios Plugins that will help us accomplish a lot of stuff including monitoring the localhost. We will thus fetch the latest stable release of plugins, extract and install it in our system. You can find the plugins at Nagios Plugins. Follow along

Fetch and extract the plugins

cd ~
tar xvf nagios-plugins-$VER.tar.gz

Navigate into the new plugins folder then compile and install.

cd nagios-plugins-$VER
./configure --with-nagios-user=nagios --with-nagios-group=nagios

sudo make
sudo make install

Step 12: Allow ports on the firewall and start Nagios

In case you have a firewall running, please allow the necessary ports.

sudo ufw allow 80
sudo ufw reload

Start Nagios and Apache services

sudo systemctl restart apache2
sudo systemctl start nagios.service

Step 13: Log into Nagios Web Interface

After everything has been done well without any errors, let us open up our browser and get to see if the Nagios web interface is accessible. Open your browser and key in the IP of your server or its domain name if you had configured one and the root directory of Nagios.

http://<IP Address/FQDN>/nagios

You will be prompted for a username and password. The username as you may remember is the one we set in Step 10, that is “nagiosadmin

NagiosLogin 1

Provide credentials to access Nagios dashboard.

install nagios 4 ubuntu 02

If you click on the “Hosts” link, you should see that the localhost is up and hence being monitored thanks to the plugins we installed earlier.

NagiosLogin localhost 3


We hope this session was as informative and helpful as possible and we thank you for visiting. You make it all worthwhile. In case you are interested in other monitoring tools, the guides below will be great for you as well.

How to Install Sensu Monitoring Tool on Ubuntu 18.04 LTS

Install LibreNMS Monitoring Tool on CentOS with Letsencrypt and Nginx

How To Install Icinga2 Monitoring Tool on Ubuntu 18.04 LTS

Install Cacti Monitoring Server on Debian 10 (Buster) with Nginx

Install and Configure Zabbix Server 4.4 on Debian 10 (Buster)

How To Install Zabbix Agent on Debian 10 (Buster)

How To Install Zabbix Server on CentOS 8 / RHEL 8

How To Install Icinga2 Monitoring Tool on Ubuntu 18.04 LTS

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here