Install Nagios Core on Debian 10 Buster

Last Updated:

In this guide, we are going to learn how to install Nagios Core on Debian 10 Buster from the source. Nagios is an opensource tool that provides an enterprise-class central monitoring engine for IT monitoring, network monitoring, server and applications monitoring. It also provides a web interface for viewing current status, historical logs, and basic reports.

Install Nagios Core on Debian 10 Buster


Since we are In this guide, we are going to build Nagios from the source. As such, there are some dependencies and build tools that are required. These include some components of LAMP/LEMP Stack, Apache/Nginx and PHP. Run the command below to install them.

apt install build-essential unzip openssl libssl-dev apache2 php libapache2-mod-php php-gd libgd-dev

If you need to see how to install LEMP/LAMP stack on Debian 10 Buster, follow the links below;

Install LEMP Stack on Debian 10 Buster

Install LAMP Stack with MariaDB 10 on Debian 10 Buster

Download Nagios 4 Source code

Once the installation above completes, navigate to Nagios downloads page and download the latest stable release. Get the download link as download it as follows.

wget -P /tmp

Extract the Source code

Once the download is completes, navigate to download dir, /tmp in this guide and extract Nagios Core as follows.

cd /tmp
tar xzf nagios-4.4.3.tar.gz

Compile Nagios Core

Navigate to the Nagios source code directory and run configure script to adapt Nagios to your system. You can also configure Nagios to use Apache web server by specifying Apache configuration directory.

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

Once the configure script completes, it should give you a summary as shown below;

*** Configuration summary for nagios 4.4.3 2019-01-15 ***:

 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/sbin/traceroute

Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

To compile Nagios Core main program and CGIs, execute the command below;

make all

If the compilation is successful, proceed to setup Nagios as follows;

Create Nagios User and Group

TO create dedicated Nagios user and group, run the make command with install-groups-users option as shown below;

make install-groups-users

The command above above simply executes, groupadd -r nagios and useradd -g nagios nagios commands.

Next, add the web server user, www-data to Nagios group just created.

usermod -aG nagios www-data

Install Nagios

Run the make install command to install Nagios main program, CGIs and HTML files.

make install

Install Nagios Service

To install Nagios service configuration files and enable them to run on system boot.

make install-daemoninit

Install Command Mode

Run the command below install and configure permissions on the directory for holding external command file.

make install-commandmode

Install Nagios Configuration Files

To setup Nagios configuration files, run the make command with install-config option.

make install-config

This installs sample config files in /usr/local/nagios/etc

Install Nagios Apache Config files

To install Apache configuration files for Nagios web interface, execute;

make install-webconf

Enable Apache rewrite and CGI modules.

a2enmod rewrite cgi

Nagios with Apache web server is now configured.

Setup Nagios Apache Authentication

To setup Nagios Web authentication, you need to create an Apache user for authentication. This can be done using the htpasswd command.

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

The user, nagiosadmin, is used by default. If you need to use a different user, you need to replace all the occurences of nagiosadmin on the /usr/local/nagios/etc/cgi.cfg file with the user you created. For example, if you use like admin, replace nagiosadmin as shown below.

sed -i 's/nagiosadmin/admin/g' /usr/local/nagios/etc/cgi.cfg

If you also want to use a different authentication user file instead of, /usr/local/nagios/etc/htpasswd.users, ensure you edit the Nagios Apache configuration file, /etc/apache2/sites-enabled/nagios.conf and change the value of AuthUserFile.

Set the ownership of the Nagios Apache authentication configuration file to web-server user, www-data.

chown www-data.www-data /usr/local/nagios/etc/htpasswd.users

Adjust the file permissions appropriately such that the owner (www-data) have read write access, the group has read access.

chmod 640 /usr/local/nagios/etc/htpasswd.users

Start Apache Web server

Once you are done with configuration, restart Apache.

systemctl restart apache2

If any firewall is running on your system, be sure to enable Apache through it.

ufw allow 80

Start Nagios Core service

Start Nagios Core service by running the command below;

systemctl start nagios.service

To check the status

systemctl status nagios.service
● nagios.service - Nagios Core 4.4.3
   Loaded: loaded (/lib/systemd/system/nagios.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-07-25 03:56:52 EDT; 2s ago
  Process: 5238 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
  Process: 5239 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
 Main PID: 5240 (nagios)
    Tasks: 5 (limit: 4701)
   Memory: 1.9M
   CGroup: /system.slice/nagios.service
           ├─5240 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
           ├─5241 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─5242 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─5243 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           └─5244 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh

If you need to go through the Nagios logs, the log file is;


Accessing Nagios on Debian 10 Buster

Once you are done with the configuration, navigate to the browser and access your Nagios with the address http://<server-IP>/nagios. You will be prompted to enter username and password created above to login.

Install Nagios Core on Debian 10 Buster

By default, Nagios doesn’t monitor the status of hosts and services without Nagios plugins, which are not installed by default. If you check the current status of the hosts, localhost server shows state as DOWN.

Nagios host summary Debian 10 Buster

If you need to monitor your endpoints or even including your nagios server itself you need to install Nagios plugins.

Install Nagios Plugins

To monitor your local system (Nagios server), just install the plugins as shown below;

Download the Nagios Plugins

wget -P /tmp/

Extract and install the plugins.

cd /tmp
tar xzf nagios-plugins-2.2.1.tar.gz

Compile and install the plugins. Add

cd nagios-plugins-2.2.1/
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make && make install

If the installation is successful, the plugins are installed under /usr/local/nagios/libexec.

Restart Nagios.

systemctl restart nagios

If you login to your Nagios web UI, you should now be able to check the status of the host and services being monitored.

Host Status

Nagios host status Debian 10 Buster

Host Services

Nagios host services Debian 10 Buster

There you go. You have successfully install and configured Nagios on Debian 10 Buster. If you need to monitor you Linux/Windows Hosts or any other device, see out links below;

Monitor Linux Hosts using Nagios check_by_ssh Plugin

How to Install Nagios Plugins and NRPE agents on CentOS 7/RHEL 7/Fedora 29

How to Install Nagios Plugins From Source RHEL/CentOS/Oracle Linux

How to Install and Configure NSClient++ Nagios Agent on Windows System

How to Install and Configure Nagios Core From the Source Ubuntu 18.04

Install and Configure SNMP on Ubuntu 18.04 and CentOS 7


We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
I am the Co-founder of, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

4 thoughts on “Install Nagios Core on Debian 10 Buster”

  1. Thank you for one of the most comprehensive, easiest checklists I’ve experienced. I was upgrading my NAS (which was running Nagios 3) to a newer box, and I thought I’d need the usual jiggery-pokery to get it running on a newer Debian / Apache configuration.

    This just worked on the first shot. As one who had previously built and configured Nagios 2 and 3 from scratch, this was an awesome timesaver. Thank you for taking the time to document it.


Leave a Comment