How to Install Nagios Monitoring tool on Ubuntu Linux

Where necessary, you may need to have access to a VPS server so you can follow how to implement the steps in this article.  You can get a cheaper VPS Server from Contabo with 4vCPU cores, 8GM RAM, and 32TB Bandwidth for less than $5.50 per month. Get this deal here now

Table of Contents

Cloud VPS S

$5.50 Monthly
  • 4 vCPU Cores | 8GB RAM


$15.50 Monthly
  • 6 vCPU Cores | 16GB RAM


$17.50 Monthly
  • 8 vCPU Cores | 24GB RAM

Nagios is a popular open-source monitoring tool used for monitoring the infrastructure and ensuring the availability of services. Here’s a step-by-step guide to installing Nagios on Ubuntu Linux:

Note: These instructions are based on a basic setup, and you may need to adjust them based on your specific requirements.


  1. Ubuntu Server: Make sure you have a clean Ubuntu server installed. You can download the latest version from the official Ubuntu website.
  2. Update System:

   sudo apt update
   sudo apt upgrade

Install Required Packages

Before we install Nagios, we need to first install a couple of packages that are crucial for the overrall setup

Install Apache

Apache is used in Nagios installation to provide a web interface for monitoring and managing the Nagios system. The web interface allows users to interact with Nagios, view monitoring status, configure hosts and services, and receive alerts.

   sudo apt install apache2

Install PHP

PHP is used for the functioning of the Nagios browser-based interface;

   sudo apt install php libapache2-mod-php

Install Additional Dependencies

You can also install additional packages using the following command

sudo apt install build-essential unzip openssl libssl-dev wget

Download and Install Nagios Core:

Now to install Nagios, we need to follow the steps below;

Create a Nagios User and Group

In the context of Nagios, the creation of a dedicated user and group is part of the installation process, and it is done to enhance security and control access to the Nagios files and processes

sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -aG nagcmd nagios
sudo usermod -aG nagcmd www-data

Download Nagios Core

You can now download the Nagios core installation files using the following command;


The above command will download a zipped archive file so we need to run the following command to extract it

tar -zxvf nagios-<version>.tar.gz

Navigate to the Nagios Directory

To go to the Nagios directory, use the following command;

cd nagios-<version>

Configure and Compile Nagios

The configuration and compilation of Nagios can be done by the following command;

./configure --with-httpd-conf=/etc/apache2/sites-enabled
 make all

Run the Installation of Nagios

You can run the installation of Nagios using these commands;

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

Create Nagios Admin User

Create a Nagios Admin user using the following command;

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

Install Nagios Plugins:

Nagios plugins are executable scripts or compiled binaries that extend the functionality of Nagios by enabling it to monitor various services, devices, and performance metrics. These plugins are essential components that allow Nagios to check the status of hosts and services, collect performance data, and generate alerts based on predefined criteria.

To download the Nagios plugins, use the following command;

   cd ~

Extract the zipped file using the following command;

   tar -zxvf nagios-plugins-<version>.tar.gz

Navigate to the Nagios Plugins Directory:

To go to the Nagios plugins directory, run the following command;

cd nagios-plugins-<version>

Configure and Compile Nagios Plugins

So, to configure and compile the Nagios plugins, you can run the following command;

   ./configure --with-nagios-user=nagios --with-nagios-group=nagios

Install Nagios Plugins

Install the Nagios plugins by running the following command;

sudo make install

Configure Apache for Nagios

We need to set up the Apache server by installing the following modules

sudo a2enmod cgi rewrite

You can now restart the Apache server using this command;

sudo systemctl restart apache2

Access Nagios Web Interface:

  1. Open a web browser and go to http://<your-server-IP>/nagios.
  2. Log in with the username nagiosadmin and the password you set during the htpasswd command.

Now, you should have Nagios installed and accessible through the web interface. You can start adding hosts, and services, and configuring alerts based on your monitoring requirements.

Hire us to handle what you want

Hire us through our Fiverr Profile and leave all the complicated & technical stuff to us. Here are some of the things we can do for you:

  • Website migration, troubleshooting, and maintenance.
  • Server & application deployment, scaling, troubleshooting, and maintenance
  • Deployment of Kubernetes, Docker, Cloudron, Ant Media, Apache, Nginx,  OpenVPN, cPanel, WHMCS, WordPress, and more
  • Everything you need on AWS, IBM Cloud, GCP, Azure, Oracle Cloud, Alibaba Cloud, Linode, Contabo, DigitalOcean, Ionos, Vultr, GoDaddy, HostGator, Namecheap, DreamHost, and more.

We will design, configure, deploy, or troubleshoot anything you want. Starting from $10, we will get your job done in the shortest time possible. Your payment is safe with Fiverr as we will only be paid once your project is completed.