15 C

How To Install Nagios 4 on Centos 8 / RHEL 8.

Nagios is network monitoring tool. In this tutorial, we will learn how to Install and configure Nagious 4 on Centos / RHEL 8. Nagious is configured using text files & provides web interface for ease to use for administration and Monitoring. Just follow these steps to quickly install & configure Nagious 4:


  • SELinux (Passive mode):
sudo sed -i 's/SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
sudo setenforce 0

Step 1: Installing Dependencies

Update your system.

sudo dnf updates
- Advertisement -

Install required Dependencies.

sudo dnf install @php
sudo dnf install @perl @httpd wget unzip glibc automake glibc-common gettext autoconf php php-cli gcc gd gd-devel net-snmp openssl-devel unzip net-snmp postfix net-snmp-utils

Guide for Installing Development Tools on RHEL 8 / Cento 8.

sudo dnf groupinstall "Development Tools"

Now, start and enable httpd and php-fpm services.

sudo systemctl enable --now httpd php-fpm

Checki status is running.

systemctl status http php-fpm

Detailed instructions for the Installation of PHP and httpd.

Step 2: Downloading Nagios Core

Change directory to /usr/src/. Go to latest-release page of Nagios to download.

sudo su -
cd /usr/src

Create nagios-$VER directory.

Download & extract Nagios tarball.


Change path to created folder.

cd nagios-$VER

Step 3: Compile Nagios Core on Centos 8 / RHEL 8.

a. Run the configure script by command below:



b. To compile the main program and CGIs, run the make command with all options.

sudo make all


c. Create User And Group

This will create user and groups in Nagios

Add apache user to Nagios Group.

make install-groups-users
usermod -a -G nagios apache

d. Install Nagios on Centos / RHEL 8.

Install Nagios base.

make install

e. Install the init script in /lib/systemd/system.

make install-init

f. Install and configure the permissions on the directory for holding the external command file.

make install-commandmode

g. Install sample config files in /usr/local/nagios/etc.

make install-config

h. Install the Apache config file for the Nagios web interface.

make install-webconf

i. Install the Exfoliation theme for the Nagios web interface.

make install-exfoliation

j. You can install classic theme for Nagios web interface by given command

make install-classicui

Step 4: Creating Nagios Web User

We need to create a user account for Nagios web interface . Use the given command:

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

Restart Apache services to take effect.

systemctl restart httpd

Step 5: Installing Nagios Plugins

Plugins are used to provide more monitoring features.
Switch to /usr/src directory.

cd /usr/src

Create new directory as nagios-plugins-$VER

mkdir nagios-plugins-$VER

Download Nagios plugins from Github releases page.

Extract it to /usr/src/nagios-plugins-$VER directory.

Now, change directory to nagios-$VER.

cd 'nagios-$VER'

Use this command to install and compile Nagios Plugins.

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


Step 6: Verifying Installation & Starting Nagios Services.

Make sure your Nagios installation is working properly.

 /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 

Start & Enable Nagios service to start at boot.

sudo systemctl enable --now nagios

Re-check the service status.

systemctl status nagios

Step 7: Accessing Nagios Web Dashboard

Remove firewall restrictions:

sudo firewall-cmd --permanent --add-service={http,https}
sudo firewall-cmd --reload

Access Dashboard by visiting http:[IP/hostname]/nagios/
Fill out Authentication details:

Username: nagiosadmin

You can add device to be monitored in Dashboard.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article