How to Install Nagios on Ubuntu 20.04 | 18.04

How to Install Nagios on Ubuntu 20.04|18.04

In this article, we are going to show you that how to Install Nagios on Ubuntu 20.04 | 18.04. If you want to learn about Installing Nagios on Ubuntu then this article is ideal for you.

Nagios is a free and open-source computer-software application that is used to monitor the networks, servers, systems, services and infrastructure which are running on Windows and Linux systems.  In case of failure, Nagios will send notification alerts using various methods.

To know more information about Nagios, go to its official website .

Ubuntu is a Linux Operating System based on Debian and mostly composed of non-profit(free) and open-source software. It is a complete Linux operating system that compatible with desktops, laptops, server and other devices. Ubuntu is Open Source so it is freely available for both community and professional support.

if you are a learner and looking for a Linux distribution for Learning then Ubuntu Linux Operating System is best for you as a beginning.

Follow the below steps for starting to install Nagios on Ubuntu 20.04 | 18.04 :

Install Nagios on Ubuntu 20.04 | 18.04


Step 1 : Prerequisites

To install Nagios, you must need to logged in with root or user with sudo privileges.


Step 2 : Install Nagios on Ubuntu

By default, The Nagios 4 package is available in the Ubuntu standard repository, so you can install it using apt package manager.

Run the below commands to install Chromium on Ubuntu :

sudo apt update
sudo apt install nagios4 nagios-plugins-contrib nagios-nrpe-plugin

When you run the above command, it will install all required packages including Nagios Core, Nagios Plugins, and Apache.

The Apache configuration file comes with Nagios which depends on the mod_authz_groupfile and mod_auth_digest modules. These modules are disabled by default and you need to enable both of these to allow or deny access to authenticated by group membership, and mod_authz_groupfile enables the MD5 digest authentication.

Run the below commands to enable the both modules:

sudo a2enmod authz_groupfile auth_digest

Step 3 : Apache Configuration

The default Apache configuration settings allows access to Nagios only from localhost and private IPs. So we need to change the Apache configuration settings so that only authorized users can view the Nagios interface and issue commands.

Open the Apache configuration file, run the below command:

sudo nano /etc/apache2/conf-enabled/nagios4-cgi.conf

When you run the above command, it will open the Apache configuration file. now comment the lines starting with Require ip, “<Files “cmd.cgi”> ”, “” and Require all granted and uncomment the line containing Require valid-user .

After changing above setting, save and close the configuration file.

Now restart Apache to take effect of configuration:

sudo systemctl restart apache2

To verify that both Apache and Nagios are working properly or not by checking their status:

sudo systemctl status apache2
sudo systemctl status nagios4

Step 4 : Creating User Account

You can log in to the Nagios web interface using by default user named “nagiosadmin” . it is having administrative privileges.

Run the below command to create the user:

sudo htdigest -c /etc/nagios4/htdigest.users Nagios4 nagiosadmin

When you run the above command, it will be prompted to enter and confirm the user’s password.

Output

New password: 
Re-type new password: 
Adding password for user nagiosadmin

Now restart Apache to take effect of configuration:

sudo systemctl restart apache2

Step 5 : Configuring Firewall

Ubuntu comes with a firewall called UFW. If the firewall is enabled on your system then you need to open the HTTP and HTTPS ports:

sudo ufw allow Apache

Step 6 : Access Nagios Web Interface

Now open your favorite web browser and type your server’s domain name or public IP address with /nagios as show below :

http(s)://your_domain_or_ip_address/nagios

Enter the nagiosadmin user login credentials that created in above steps and after successfully authentication, you will be redirected to the default Nagios home page.

That’s all

If you face any error and issue in above steps , please use comment box below to report.


Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top