Install and Configure Nagios Core From Source on Ubuntu 18.04


In this tutorial we are going to learn how to install and Configure Nagios Core From Source on Ubuntu 18.04 for server resource consumption and availability monitoring.

In our last tutorial, we covered how to Install and Configure Nagios Core from Ubuntu repositories.

Stacer The best Linux system opti...
Stacer The best Linux system optimizer and monitoring tool

How to Install and Configure Nagios Core From repo Ubuntu 18.04

Install and Configure Nagios Core From Source  on Ubuntu 18.04

Installation from the source ensures that we get latest features, security updates, and bug fixes. Follow through this tutorial to build Nagios and its components from the source.

Install the necessary Nagios build tools and development libraries

apt install -y autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php7.2 libgd-dev

Download the source code of the latest stable release of Nagios Core from here.

wget -P /tmp

Compile and Install Nagios

cd /tmp
tar xzf nagios-4.4.1.tar.gz
cd nagios-4.4.1
./configure --with-httpd-conf=/etc/apache2/sites-enabled
make all

Create a user and a group that will be used to run Nagios. Add apache user to the nagios group

make install-groups-users
usermod -aG nagios www-data

Install Nagios Core binaries, CGIs and HTML files.

make install

Install the init scripts for Nagios services/daemon

make install-daemoninit

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

make install-commandmode

Install sample Nagios configuration files in /usr/local/nagios/etc

make install-config

Install and configure apache web server configuration files and enable apache rewrite and cgi modules

make install-webconf
a2enmod rewrite
a2enmod cgi

If firewall is running, allow apache through it.

ufw allow Apache;ufw reload

Create a user account for logging into the Nagios web interface.

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

where nagiosadmin is the username for logging in to Nagios Web interface and file htpasswd.users stores user credentials. When adding more users, omit option -c to avoid replacing existing users.

Start and enable both Apache and Nagios services as follows:

systemctl start apache2;systemctl enable apache2
systemctl start nagios;systemctl enable nagios

Now access the Nagios web interface using the following URL, http://<ip-address-OR-hostname>/nagios.

You will be prompted to login. So login with admin user created above.

Screenshot 20180818 004029

Once you login, this the Nagios dashboard that welcomes you.

Screenshot 20180818 004536

By default, Nagios just monitors itself. See other Nagios related tutorials by following the links below;

Congratulations! You Nagios server is now ready and running. That marks the end of our on how to install and configure Nagios core from source on Ubuntu 18.04.

Add Hosts to Nagios Server For Monitoring

Install Nagios NRPE Agent on CentOS 8

Monitor SSL/TLS Certificates Expiry with Nagios

Configure Nagios Email Notification Using Gmail


Please enter your comment!
Please enter your name here