How to Install Nagios on CentOS 8

Install Nagios on CentOS 8

In this article, we will have explained the necessary steps to install and configure Nagios on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Nagios is an open source monitoring tool used to monitor different Linux Machines or different client hosts. It monitors the HTTP, FTP, SSH, SMTP, etc along-with the CPU usage, RAM, Disk Usage, and different process that are running.

Nagios Core Features

  • Monitoring of network services e.g SMTP, POP3, HTTP, NNTP, ICMP, SNMP, FTP, SSH
  • Monitoring of host resources such as processor load, disk usage, system logs on a majority of operating systems, including Microsoft Windows
  • Monitoring of any hardware (like probes for temperature, alarms, etc.) which have the ability to send collected data via a network to specifically written plugins
  • A simple plugin design that allows users to easily develop their own service checks depending on needs, by using their tools of choice (shell scripts, C++, Perl, Ruby, Python, PHP, C#, etc.)
  • A web-interface for viewing current network status, notifications, problem history, log files, etc.
  • Support for implementing performance data graphing
  • Support for database backend such as NDOUtils
  • Push notifications

Install Nagios on CentOS 8

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo dnf install epel-release
sudo dnf update

Step 2. Install Required Build Tools.

Run the command below to dependency packages:

sudo dnf install gcc glibc glibc-common perl httpd php php-cli wget net-snmp gd gd-devel

Step 3. Download Nagios Core Source Code.

Nagios Core 4.4.6 is the latest stable release at the time of this writing. The source code is available at GitHub and we can easily download it by using wget the command:

wget -O nagioscore.tar.gz

After downloading the tarball file, extract it using the command:

tar xzf nagioscore.tar.gz

Next, configure the Nagios Core source according to our CentOS 8 environment:

cd nagioscore-nagios-4.4.6
make all
make install-groups-users

Then, add Apache user to the Nagios group:

usermod -aG nagios apache

Step 4. Install Nagios Core on CentOS 8.

Run the following command to install Nagios:

make install

After that, create the Nagios service by using the following command:

make install-daemoninit

Next, install and configure the external command file as well as the permissions on the directory holding the external commands file:

make install-commandmode

Install Nagios Sample configuration file:

make install-config

Next, install the Apache HTTP server configuration files for Nagios:

make install-webconf

Step 5. Configure Nagios Apache Authentication.

Create an Admin user and add it to htaccess password file:

$ htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

Once you are done with the configuration, start and enable Apache to run on system boot:

systemctl start httpd.service
systemctl start nagios.service

If firewallD is running on your system, be sure to enable external access to Apache:

firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --reload

Step 6. Install Nagios Plugins.

Download Nagios Plugins to /tmp the directory and extract it:

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

Compile and install the Nagios plugins:

./configure --with-nagios-user=nagios --with-nagios-group=nagios
make install

Step 7. Access Nagios Web Interface.

Now access the Nagios web interface by going following URL in your web browser:


Congratulation, you have learned how to install and configure Nagios on CentOS 8. If you have any questions, please leave a comment below.