Nagios Core is one of the most widely-deployed open-source IT infrastructure monitoring systems in the world, providing alerting and status dashboards for hosts, services, and network devices. On RHEL 8, installing Nagios Core from source gives you the latest release and full control over the build configuration. This tutorial walks through every step from prerequisite packages to a running web UI with authenticated access. By the end you will have Nagios Core serving its dashboard through Apache HTTP Server and monitoring the local host.
Prerequisites
- A RHEL 8 server (or compatible clone such as AlmaLinux 8 / Rocky Linux 8) with a non-root sudo user
- RHEL 8 subscribed to the BaseOS and AppStream repositories, or EPEL 8 enabled (
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm) - At least 1 GB RAM and 2 GB free disk space
- Ports 80 and/or 443 open in firewalld
- Root or sudo access throughout the tutorial
Step 1 — Install Build Dependencies and Apache
Nagios Core must be compiled from source, so you need the GCC toolchain, development headers, and an HTTP server before downloading anything. The following command installs everything in one shot.
sudo dnf install -y gcc glibc glibc-common perl
openssl-devel wget unzip net-snmp net-snmp-utils
httpd php gd gd-devel make gettext autoconf automake
After the install completes, enable and start Apache so it is ready when the Nagios installer writes its virtual-host configuration file.
sudo systemctl enable --now httpd
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
Step 2 — Create the Nagios User and Group
Nagios runs its daemon under a dedicated system account. Create the nagios user and group, then add the Apache runtime user (apache) to the nagios group so the web interface can read command pipes.
sudo useradd --system --no-create-home --shell /sbin/nologin nagios
sudo groupadd nagcmd
sudo usermod -aG nagcmd nagios
sudo usermod -aG nagcmd apache
Step 3 — Download and Compile Nagios Core
Download the latest stable Nagios Core tarball from the official GitHub releases page. At the time of writing the current stable release is 4.5.x — replace the version number if a newer release is available.
cd /tmp
wget https://github.com/NagiosEnterprises/nagioscore/releases/download/nagios-4.5.2/nagios-4.5.2.tar.gz
tar xzf nagios-4.5.2.tar.gz
cd nagios-4.5.2
./configure --with-httpd-conf=/etc/httpd/conf.d
make all
sudo make install
sudo make install-init
sudo make install-config
sudo make install-commandmode
sudo make install-daemoninit
sudo make install-webconf
The --with-httpd-conf flag tells the installer to drop the Nagios Apache snippet directly into /etc/httpd/conf.d/, which Apache loads automatically.
Step 4 — Create the Web Admin Password
Nagios ships with an htpasswd-protected web interface. Create the password file and add the nagiosadmin account that the default configuration references.
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
You will be prompted to enter and confirm a password. This credential is used to log in to the Nagios web dashboard at http://<your-server-ip>/nagios.
Step 5 — Install the Nagios Plugins
Without plugins, Nagios cannot check anything. The Nagios Plugins package provides the standard check commands referenced by the default configuration files.
cd /tmp
wget https://github.com/nagios-plugins/nagios-plugins/releases/download/release-2.4.6/nagios-plugins-2.4.6.tar.gz
tar xzf nagios-plugins-2.4.6.tar.gz
cd nagios-plugins-2.4.6
./configure --with-nagios-user=nagios --with-nagios-group=nagios
--with-openssl
make
sudo make install
Step 6 — Enable and Start Nagios
Verify the configuration files are syntactically correct, then enable the nagios service so it starts at boot and launch it alongside Apache.
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
sudo systemctl enable --now nagios
sudo systemctl restart httpd
sudo systemctl status nagios
Open a browser and navigate to http://<your-server-ip>/nagios. Log in with the nagiosadmin credentials created in Step 4. The Tactical Overview page should appear showing the localhost being monitored.
Conclusion
You have installed Nagios Core from source on RHEL 8, compiled and installed the standard Nagios Plugins, configured Apache authentication, and confirmed the service is running. The default configuration monitors the local host via five service checks — PING, HTTP, SSH, current load, and disk usage. From here you can begin adding remote hosts and services by editing the configuration files under /usr/local/nagios/etc/ and reloading the daemon with sudo systemctl reload nagios.
Next steps: Adding Remote Hosts and Services to Nagios, Configuring Email Alerting in Nagios, and Setting Up NRPE for Agent-Based Monitoring.