Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form

How to Install and Configure Nagios on Ubuntu

Posted on 21/03/202216/08/2026 Raphael Gab-Momoh By Raphael Gab-Momoh No Comments on How to Install and Configure Nagios on Ubuntu
  1. Home
  2. Linux
  3. How to Install and Configure Nagios on Ubuntu
Feature image nagios
Feature image nagios

Nagios is an open-source monitoring system that is widely used. What’s more, it maintains track of your servers and monitors them so you can be certain that your mission-critical services are up and functioning. In this article, we shall discuss ‘How to Install and Configure Nagios on Ubuntu”. Please see How to install free Hyper-V Server on a VMware Workstation, How to Configure Windows Server Core using SConfig, and “Docker Setup: Monitoring Synology with Prometheus and Grafana“.

Any production environment should employ a monitoring system like Nagios, since by monitoring uptime, CPU consumption, and disk space, you may prevent problems before they happen or before your users call you. Ever wondered how to install Nagios step by step? Here’s all you need to know about the installation process.

In this article, you’ll learn how to install and configure Nagios 4 on Ubuntu so you can use the web interface to monitor host resources. You’ll also install the Nagios Remote Plugin Executor (NRPE), an agent that runs on remote systems and allows you to monitor their resources.

Here are other interesting articles: How to Install and Configure Postfix as a Send-Only SMTP Server/, How to implement SAMBA (SMB) file shares for Servers and Clients/, also How to Configure Advanced PAM in Linux/ and How to Install LAMP Stack on Ubuntu 18.04 / and How to install MariaDB on Ubuntu

Requirements for Installing Nagios on Ubuntu

Make sure you’ve installed the following packages on your Ubuntu installation before continuing.

  • Apache 2
  • PHP
  • GCC compiler and development libraries
  • GD development libraries

You can use apt-get to install these packages by running the following commands:

sudo apt-get install apache2 libapache2-mod-php5 build-essential libgd-dev
How to install and configure Nagios on Ubuntu- 2022-03-20_14h37_23
required packages

Steps to Installing and Configuring Nagios on Ubuntu

The other steps required for the successful installation of Nagios are shown below

Step 1: Create a user account

To create a new account and a password, kindly use the command below.

/usr/sbin/useradd -m -s /bin/bash nagios
passwd nagios
How to install and configure Nagios on Ubuntu-userandpasswd
user & passwd created

Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the Nagios user and the apache user to the group.

/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd www-data

Step 2: Download Nagios together with its plugin

To this end, make a separate directory where the downloaded packages will be kept.

mkdir ~/downloads
cd ~/downloads

Download the source code tarballs of both Nagios Core and the Nagios plugins

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.2.1.tar.gz
wget https://nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz
How to install and configure nagios on Ubuntu
nagios

The Plugin

how to install and configure nagios on Ubuntu-plugin
nagios plugin

Step 3: Compile and Install Nagios Core on Ubuntu

Meanwhile, extract the Nagios Core source code tarball.

cd ~/downloads
tar xzf nagios-4.2.1.tar.gz
cd nagios-4.2.1

Run the Nagios configure script as follows, using the name of the group you defined previously as a parameter:

./configure --with-command-group=nagcmd
how to install and configure nagios on Ubuntu-config-option-for-nagios
config options for nagios

Then, compile the Nagios Core source code.

make all
makeall-receipt

Consequently, set permissions on the external command directory and install binaries, an init script, and example config files.

make install
make install-init
make install-config
make install-commandmode
boom
external command directory

Here is how to fix “The module ping was not found in configured module paths, core modules are missing“, and how to “Harden your Veeam Backup Server with Microsoft AppLocker“.

Step 4: Customize Configuration

In addition, change the email address associated with the nagiosadmin contact definition to the address you’d want to use for receiving alerts in the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor.

vi /usr/local/nagios/etc/objects/contacts.cfg
email
i changed to my email

Please see Monitor Windows Hosts via Nagios: A Guide, How to Backup and Restore your WordPress Files and Database and how to fix “The module ping was not found in configured module paths, core modules are missing“.

Step 5: Set up the Web User Interface

Moreover, install the Nagios Core web config file in the Apache conf.d directory.

make install-webconf

Possible Error

/usr/bin/install: regular file cannot be created 'etc/apache2/sites-enabled/nagios.conf': File or directory doesn't exist
Makefile:298: failure in the instructions for objective 'install-webconf'
make: *** [install-webconf] Error 1

Resolved by running:

/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-enabled/nagios.conf
./configure --with-httpd-conf=/etc/apache2/sites-enabled
instll-mkeconf
fixed

Furthermore, to use the Nagios Core web interface, create a nagiosadmin account. But, remember the password you choose for this account; you’ll need it in the future.

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

Restart Apache to make the new settings take effect.

/etc/init.d/apache2 reload

Step 6:  Compile and Install the Nagios Plugins

On the other hand, extract the Nagios plugins source code tarball.

cd ~/downloads
tar xzf nagios-plugins-2.3.3.tar.gz
cd nagios-plugins-2.3.3

Then, compile and install the plugins.

./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
make
make & plugin install

Step7 : Start Nagios Core

Configure Nagios Core to automatically start when the system boots.

ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the sample Nagios Core configuration files.

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

If there are no errors, start Nagios Core.

/etc/init.d/nagios start
startnagios

Step 8: Login to the Web Interface

Type the command below in your VM or environment’s browser. You’ll be prompted for the username (nagiosadmin) and password you specified earlier

http://localhost/nagios/
login
web interface
how to install and configure nagios on Ubuntu-login
logged in

Step 9: Additional Modifications:

If you want to receive email notifications for Nagios Core alerts, you need to install the mailx (Postfix) package.

sudo apt-get install mailx
sudo apt-get install postfix
how to install and configure Nagios on Ubuntu-posfixconfig
postfix
sudo /etc/init.d/nagios restart
how to install and configure Nagios on Ubuntu-postfix

Summary

We installed Nagios by following the series of steps shown above. Rest assured, you will successfully install and configure Nagios on Ubuntu, following the aforementioned steps. Furthermore, you might want to refer to this guide on how to monitor Windows hosts via Nagios

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
Linux Tags:Monitoring

Post navigation

Previous Post: How to add one or more external displays with your Mac
Next Post: How to Set Up and Configure a Squid Proxy Server

Related Posts

  • featurekube
    How to Install and Use Minikube on a Linux System Containers
  • Slide2 1
    SU Authentication Fix: Sudo Permission Denied in Ubuntu Linux
  • download
    Remove Packages from a Linux: Quick Guide Linux
  • AADSTS900144
    Fix AADSTS900144: The request body must contain the parameter Linux
  • sdfdghjk
    How to fix “Job for Mattermost service failed” error Linux
  • dns
    How to setup a cache-only DNS server Linux

More Related Articles

featurekube How to Install and Use Minikube on a Linux System Containers
Slide2 1 SU Authentication Fix: Sudo Permission Denied in Ubuntu Linux
download Remove Packages from a Linux: Quick Guide Linux
AADSTS900144 Fix AADSTS900144: The request body must contain the parameter Linux
sdfdghjk How to fix “Job for Mattermost service failed” error Linux
dns How to setup a cache-only DNS server Linux

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

Veeam Vanguard

  • fix this PC cannot run on Windows
    How to Fix “This PC Can’t Run Windows 11” on Hyper Windows
  • EC2 Public IP
    How to Allocate, Associate, Disassociate and Release Elastic IP Address from an EC2 Instance AWS/Azure/OpenShift
  • Disable and Enable USB in Windows
    Disable and Enable USB Usage for Certain Users in Windows Windows
  • Windows 11 taskbar features remove 1
    How to modify Windows 11 Taskbar via Intune and GPO Windows
  • windows 10 creators update wallpaper
    Run or Edit and Delete Tasks via Windows Task Scheduler Windows
  • Perform Site Maintenance or reset this site greyed out
    Fix “Perform Site Maintenance or reset this site” greyed out Windows Server
  • images 1 1
    How To Use Pleasant Password Private Folder Password Manager
  • Featured image 1
    How to Change User Account Type in Windows 10 Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,762 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Contact
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon
  • Bsky

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2026 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.