In this tutorial, we will walk through the installation process of Nagios on Debian.
Before we start the installation process, make sure the following prerequisites are fulfilled.
$ sudo apt update && sudo apt upgrade
Nagios requires various packages to be installed on the Debian system. To install these dependencies, run the following command:
$ sudo apt install -y autoconf gcc libc6 make wget unzip apache2 php libapache2-mod-php7.3 libgd-dev
Download the latest Nagios source files from the Nagios website using the following command:
$ cd /opt/
$ sudo curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.6.tar.gz
Next, download the Nagios Plugins:
$ sudo curl -L -O https://nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz
Extract the downloaded files:
$ sudo tar -zxvf nagios-4.4.6.tar.gz
$ sudo tar -zxvf nagios-plugins-2.3.3.tar.gz
To install Nagios, go to the extracted directory and execute the configure
, make
, and make install
commands.
$ cd nagios-4.4.6/
$ sudo ./configure --with-command-group=nagcmd
$ sudo make all
$ sudo make install
$ sudo make install-commandmode
$ sudo make install-init
$ sudo make install-config
Next, install the Nagios plugins by going to the extracted plugin directory and running the same set of commands.
$ cd ../nagios-plugins-2.3.3/
$ sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
$ sudo make
$ sudo make install
Create the Nagios user and group to run Nagios on the system.
$ sudo useradd nagios
$ sudo groupadd nagcmd
$ sudo usermod -a -G nagcmd nagios
Nagios has a web interface that requires Apache to serve web pages. Configure Apache to serve Nagios pages.
$ sudo make install-webconf
$ sudo a2enmod rewrite
$ sudo systemctl restart apache2
Nagios uses port 80 for its web interface. Open the HTTP port on the firewall using the following command:
$ sudo ufw allow http/tcp
Run the following command to start the Nagios service:
$ sudo systemctl start nagios
Navigate to http://localhost/nagios/ in your web browser to ensure Nagios is up and running correctly.
Congratulations! You have successfully installed Nagios on Debian Latest. Nagios can now be used for monitoring hosts and services on your server.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!