In this article, we’ll walk you through the process of installing Nagios, a powerful open-source monitoring system, on Fedora 39. This guide assumes you have a basic understanding of Linux and know how to use the shell. You should have a server running Fedora 39 and access to the terminal to execute commands. We recommend using a fresh OS install to prevent any potential issues.

Installation Process

Step 1: Update System Packages

Start by updating your system packages. This ensures that you have the latest versions of all software and libraries, which can help prevent compatibility issues. Run the following commands in the terminal:

sudo dnf clean all
sudo dnf update
sudo dnf install httpd php gcc glibc gd gd-devel wget tar make

Step 2: Create Nagios User and Group

Next, create a Nagios user and group to enhance system security:

sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios

Step 3: Install Nagios

Now, download the Nagios Core and Nagios Plugins source files. Use the wget command to download the files:

wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.x.tar.gz
wget https://nagios-plugins.org/download/nagios-plugins-x.x.tar.gz

Extract the downloaded files and compile Nagios Core:

tar xzf nagios-4.x.tar.gz
cd nagios-4.x/
./configure --with-command-group=nagcmd
make all

Then, install the Nagios binaries, init scripts, and sample configuration files:

sudo make install
sudo make install-init
sudo make install-config
sudo make install-commandmode

Set the necessary permissions:

sudo usermod -a -G nagcmd apache

Finally, verify the Nagios configuration:

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

Step 4: Configure Nagios

With Nagios installed, configure the web server to serve the Nagios web interface. Edit the Apache configuration file and add the necessary directives:

sudo nano /etc/httpd/conf.d/nagios.conf

Add the following lines:

ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

<Directory "/usr/local/nagios/sbin">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>

Alias /nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>

Save the file, then set up user authentication for the Nagios web interface. Create a nagiosadmin user and set a password:

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

Step 5: Access the Nagios Web UI

Access the Nagios web interface by navigating to http://your_server_ip/nagios in your web browser. Complete the initial setup and start monitoring your first host and service to ensure Nagios is functioning correctly.

If you’re looking for a reliable VPS provider, consider Shape.host and their Cloud VPS services. They offer efficient, scalable, and secure cloud hosting solutions perfect for any business needs.