AlmaLinux is gaining popularity as an alternative to CentOS. Many enterprises or even tech enthusiasts are switching to Alma after CentOS announced its EOL. Of course, the transformation from CentOS to AlmaLinux has its own challenges although they introduced the Elevate program to make this switch swiftly.
Good byes to CentOS 🙁

Monitoring the infrastructure is core for the IT services industry. Many enterprises opt for commercial solutions and there is a big chunk of companies or people using open source solutions. I am not a promoter of the commercial side of the option but am more interested in the available open-source options such as Zabbix, Nagios, etc. I recently attempted the installation of Nagios core and Nagios plugins on AlmaLinux 8 & AlmaLinux 9 and the same journey I will be sharing with you here. Buckle the sits and get ready for the flight 🚀🚀🚀
Installation of Nagios Core
Nagios will have two parts of the installation. In this part, we will install the Nagios core, the backbone of our monitoring node.
There are cloud providers like Hetzner (which I use mostly for test purposes); all their Almalinux-powered instances come with permissive mode SELinux. In case, you are using any other provider or your own machine let’s verify the status of SELinux first.
[root@nagios-core ~]# getenforce
Permissive
If your server has SELinux ‘enforcing‘ then let us disable that through the config file and make it Permissive.
[root@nagios-core ~]# sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
[root@nagios-core ~]# setenforce 0
[root@nagios-core ~]# grep SELINUX /etc/selinux/config | head -2
# SELINUX=disabled
SELINUX=disabled
[root@nagios-core ~]# getenforce
Permissive
Nagios require various shared libraries, Apache (HTTPD), Perl, OpenSSL toolkit and PHP. Let’s install them.
[root@nagios-core ~]# dnf install -y gcc glibc glibc-common perl httpd php gd gd-devel
[root@nagios-core ~]# dnf install openssl-devel
Now we are completed with all the prerequisites. Let us download the Nagios core files for the installation. You can learn more about the latest releases on their GitHub. As of now the latest version is “nagios-4.5.1.tar.gz” and I am going with that:
[root@nagios-core]# cd /tmp
[root@nagios-core tmp]# wget https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.5.1.tar.gz
[root@nagios-core tmp]# tar -xvzf nagios-4.5.1.tar.gz
Change the directory to nagioscore-nagios-x.x.x and start with compilation and configuration (You can skip the following explanation and directly jump to steps).
[root@nagios-core tmp]# cd nagioscore-nagios-4.5.1/
[root@nagios-core nagioscore-nagios-4.5.1]#
More about compilation and configuration: Through compilation, we will be converting human-readable code to machine-readable format. Below, you will see that we are running “./configure” which checks the system configuration and ready all the configuration files for our environment “make all” will run the compilation and later you can start with the configuration part.
./configure
make all
If the compilation is completed without any issues; you should expect this kind of output after the “make all” command.
*** Compile finished ***
If the main program and CGIs compiled without any errors, you
can continue with testing or installing Nagios as follows (type
'make' without any arguments for a list of all possible options):
make test
- This runs the test suite
make install
- This installs the main program, CGIs, and HTML files
make install-init
- This installs the init script in /lib/systemd/system
make install-daemoninit
- This will initialize the init script
in /lib/systemd/system
make install-groups-users
- This adds the users and groups if they do not exist
make install-commandmode
- This installs and configures permissions on the
directory for holding the external command file
make install-config
- This installs *SAMPLE* config files in /usr/local/nagios/etc
You'll have to modify these sample files before you can
use Nagios. Read the HTML documentation for more info
on doing this. Pay particular attention to the docs on
object configuration files, as they determine what/how
things get monitored!
make install-webconf
- This installs the Apache config file for the Nagios
web interface
make install-exfoliation
- This installs the Exfoliation theme for the Nagios
web interface
make install-classicui
- This installs the classic theme for the Nagios
web interface
*** Support Notes *******************************************
If you have questions about configuring or running Nagios,
please make sure that you:
- Look at the sample config files
- Read the documentation on the Nagios Library at:
https://library.nagios.com
before you post a question to one of the mailing lists.
Also make sure to include pertinent information that could
help others help you. This might include:
- What version of Nagios you are using
- What version of the plugins you are using
- Relevant snippets from your config files
- Relevant error messages from the Nagios log file
For more information on obtaining support for Nagios, visit:
support.nagios.com
*************************************************************
Install the Nagios group and user. The following command will create a Nagios group first and then a user with a Nagios group. With the second command, add the “apache” user to the “nagios” group as well (all the Nagios installation will be under the Nagios user; if we have an Apache user in its own group then it won’t work with the Nagios. For Nagios to work properly we will need to add an Apache user under the Nagios group).
make install-groups-users
usermod -a -G nagios apache
Install Binary files, HTML files and CGIs.
make install
Install the service and configure them to start on boot.
make install-daemoninit
Install Command Mode to install and configure external command files.
make install-commandmode
Install sample configuration files to at least start the Nagios.
make install-config
Install and configure the Web server (Apache) configuration files.
make install-webconf
On my server, I don’t have any firewall working. If you have so, then enable/allow webserver port 80.
#For firewalld
firewall-cmd --zone=public --add-port=80/tcp
firewall-cmd --zone=public --add-port=80/tcp --permanent
#For iptables
iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT
service iptables save
We are completed with the Nagios core installation. The installation will create a default “nagiosadmin” user and for that let’s set the password:
[root@nagios-core nagioscore-nagios-4.5.1]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin
Finally, start the Apache web server and Nagios service.
systemctl start httpd.service
systemctl enable httpd.service
systemctl start nagios.service
systemctl enable nagios.service
To test the Nagios interface visit:
http://IPADDRESS/nagios (Replace IPADDRESS with your server’s IP address)
Installation of Nagios Plugins
Till now we have completed the installation of the base of our monitoring system. Nagios rely on the plugins to monitor the hosts. For everything you will see the plugins. For example: To check the server load, Nagios has a check_load plugin. Let’s start with the plugin installation:
Please note that this installation will only install a fixed set of default Nagios plugins. Nagios has a public directory for plugins which you can install later. For full documentation on Nagios plugins visit: This Page
Install the prerequisites and enable some external repositories.
yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release
yum --enablerepo=powertools,epel install perl-Net-SNMP
Download the Nagios plugin installation files. Of course, we will be downloading it in the “/tmp” directory. For now, I will be downloading “nagios-plugins-2.4.8.tar.gz” as it is the current latest version. You can check the Nagios plugin’s GitHub release page for the latest updates.
[root@nagios-core tmp]# wget https://github.com/nagios-plugins/nagios-plugins/releases/download/release-2.4.8/nagios-plugins-2.4.8.tar.gz
[root@nagios-core tmp]# tar -xvzf nagios-plugins-2.4.8.tar.gz
[root@nagios-core tmp]# cd nagios-plugins-2.4.8
[root@nagios-core nagios-plugins-2.4.8]#
Finally, let’s compile and install the Nagios plugins.
./tools/setup
./configure
make
make install
Restart the Nagios and Apache service.
systemctl restart nagios.service
systemctl restart httpd.service
Extra Tidbits
After the installation, I logged into my Nagios with “https://IPADDRESS/nagios” and I noticed for my localhost all the services were reporting the following error although the plugin’s files were present in the “/usr/local/nagios/libexec”:

This might take 5-10 minutes for Nagios to report the changes. After a few minutes, you should see it is reporting everything as expected:

Honestly, I don’t like the default Nagios theme so every time I install Nagios I always use the Vautour Style theme. Installation is pretty straightforward:
Navigate to “/usr/local/nagios” and back up the current “share” directory content.
[root@nagios-core ~]# cd /usr/local/nagios
[root@nagios-core nagios]# tar -czf sharedir-backup.tar.gz share/
[root@nagios-core nagios]#
Navigate to the Share directory and Remove all the content. Download the Vautour Style theme and extract it.
[root@nagios-core nagios]# cd share
[root@nagios-core share]# rm -rf *
[root@nagios-core share]# wget https://github.com/ynlamy/vautour-style/releases/latest/download/vautour_style.zip
[root@nagios-core share]# unzip vautour_style.zip
Restart the Nagios to make the changes effective.
[root@nagios-core share]# systemctl restart nagios
Volla! You have a new look for the Nagios.

Conclusion
Let me apologize for this lengthy article 😂 I tried to cover step-by-step procedure to install Nagios Core and Nagios Plugins on AlmaLinux 8 or 9. I was planning to add the installation of the NRPE plugin and a section for adding a remote host but that will again make the article longgggg 😵💫. So, I will cover both topics in one article separately. I hope you enjoyed this article and helped you with the installation. If you have any suggestions please feel free to drop a comment or write me on [email protected].
and thank you for reading! 🤟 Love for AlmaLinux 💜
