• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Nagios on Ubuntu 20.04

Written by Admin, Updated On August 13, 2020
monitoring, nagios, ubuntu
How to Install Nagios on Ubuntu 20.04

Nagios is the most widely used open-source monitoring system to monitor the networks, servers, services and applications which are running on Windows and Linux operating systems. It will notify alerts on failure or suboptimal performance. In this article we will learn how to install Nagios on Ubuntu 20.04.

Step 1 – Prerequisites#

You must logged in as root or user with sudo privileges.

Step 2 – Installing Nagios on Ubuntu#

By default, the Ubuntu standard repositories includes the Nagios 4. The installation is straightforward, just run the following commands:

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

The above commands will install required packages, Nagios Core, Nagios Plugins, and Apache.

By default, the Apache configuration file ships with Nagios which depends on the mod_authz_groupfile and mod_auth_digest modules. These are disabled by default and you should 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 following commands to enable the both modules:

sudo a2enmod authz_groupfile auth_digest

Step 3 – Apache Configuration#

Nagios is allowed to access only from localhost and private IPs due to the Apache default configuration. Now we will change the configuration so only allowed user can access and view.

Open the configuration file with your text editor:

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

Find the line starts with Require ip and Require all granted and uncomment the line containing Require valid-user.

Save and close the file. After that restart the Apache service to take effect of configuration:

sudo systemctl restart apache2

Check the status of Apache and Nagios wether it is working proper or not by typing:

sudo systemctl status apache2
sudo systemctl status nagios4

Step 4 – Creating User Account#

The username “nagiosadmin” having the administrative privileges by default in Nagios. With this user, you can log in to the Nagios web interface and manage your inventory.

To create a new user you should use htdigest command:

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

It will prompt to enter and confirm the user’s password.

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

It’s again required to restart the Apache service for changes to take effect:

sudo systemctl restart apache2

Step 5 – Configuring Firewall#

If your system is secured firewall, you should open the HTTP and HTTPS ports:

sudo ufw allow Apache

Step 6 – Access Nagios Web Interface#

Open your web browser and type the server’s public ip or domain name followed by /nagios to access the Nagios web interface:

http://your_domain_or_ip_address/nagios

Enter the user name and password as we previously created and it will redirect to home page on successful authentication.

That’s it. You can manage all servers, service and applications using Nagios.

Conclusion#

You have successfully learned how to install Nagios on Ubuntu 20.04 system. To know more about the Nagios visit official documentation.

If you have any questions or suggestion, please leave comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install Jenkins on Ubuntu 20.04
Next Article   Pstree Command in Linux

Related Posts

  • How to Install Apache, MySQL, PHP (LAMP) on Ubuntu 22.04

    How to Install LAMP on Ubuntu 22.04

    March 20, 2023
  • How to Install LEMP Stack on Ubuntu 22.04

    How to Install LEMP Stack on Ubuntu 22.04

    March 18, 2023
  • How to Install Memcached on Ubuntu 22.04

    How to Install Memcached on Ubuntu 22.04

    March 16, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook