How to Install Nagios Server on CentOS/RHEL 8/7/6
Abstract: Step 3 – Install Nagios Core Service After installing the required dependencies and adding user accounts. Let’s start with the Nagios core installatio
Nagios is the most popular, open source, powerful monitoring system. It enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. Nagios has the capability of monitoring application, services, entire IT infrastructure.
This is Part-1 of complete article How to Setup Nagios Monitoring Server with NagiosQL on CentOS/RHEL 7/6, In this part, you will find the steps to setup Nagios Monitoring Server on CentOS, Redhat, and Fedora systems.
Step 1 – Install Required PackagesWe assume that you have fresh installed CentOS, Red Hat or Fedora systems, So our first requirement is to install Apache and PHP first. Use the following commands to complete it. You can find detailed LAMP setup instruction here.
Install Packages:yum install httpd php php-cli gcc unzip wget glibc glibc-common gd gd-devel net-snmp yum groupinstall "development tools"Start Apache:
service httpd startStep 2 – Setup User Accounts
Now create a new nagios user account and setup a password to this account
useradd nagios passwd nagios
Now create a groud for nagios setup 「nagcmd」 and add nagios user to this group. Also add nagios user in apache group.
groupadd nagcmd usermod -a -G nagcmd nagios usermod -a -G nagcmd apacheStep 3 – Install Nagios Core Service
After installing the required dependencies and adding user accounts. Let’s start with the Nagios core installation. Download the latest Nagios core service from the official site.
cd /opt/ wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz tar xzf nagios-4.4.5.tar.gz cd nagios-4.4.5 ./configure --with-command-group=nagcmd make all make install make install-init make install-daemoninit make install-config make install-commandmode make install-exfoliation
Now use below command to setup Apache configuration for Nagios installation.
make install-webconfStep 4 – Configure Apache Authentication
We need to setup apache authentication for user nagiosadmin. Do not change this username. else you would required more changes in configuration.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Now restart Apache service to make the new settings take effect.
service httpd restartStep 5 – Install Nagios Plugins
After installing and configuring Nagios core service, Download latest nagios-plugins source and install using the following commands.
cd /opt wget http://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz tar xzf nagios-plugins-2.2.1.tar.gz cd nagios-plugins-2.2.1
Now compile and install nagios plugins
./configure --with-nagios-user=nagios --with-nagios-group=nagios make make installStep 6 – Verify and Start Nagios
First, verify the Nagios configuration file using the following command.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there is no error, let’s start the Nagios serivce
service nagios startStep 7 – Access Nagios in Web Browser
Nagios creates its own apache configuration file /etc/httpd/conf.d/nagios.conf. There are no need to make any changes to it. Simply open below url in browser.
[change domain name with your domain or ip]
http://tecadmin.example.net/nagios/
Prompting for Apache Authentication Password –
Nagios After login screen –
Finally, you have successfully installed and configured Nagios core service in your system. Now go to article install NagiosQL3 web interface for managing Nagios.