breaking news

How to Install Nagios 4.1on CentOS / RedHat

How to Install Nagios 4.1on CentOS / RedHat

April 12th, 2016


How to Install Nagios 4.1 (Monitoring Server) on CentOS / RedHat

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 capability of monitoring application, services, entire IT infrastructure.

NAGIOSCORE-Shree Niraula

This is Part-1 of complete article How to Setup Nagios Monitoring Server with NagiosQL on CentOS/ RHEL 6/5, In this part you will find the steps to setup Nagios Monitoring Server on CentOS and RedHat systems.

Step 1: Install RequiredPackages

We assume that you have fresh installed CentOS or Red Hat , So our first requirement is to install Apache and PHP first on CentOS 6.5_x64_minimal. Use the following commands to complete it.

Install Packages:

# yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp wget unzip


# service httpd start

Step 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 apache

Step 3: Install Nagios Core Service

After installing required dependencies and adding user accounts. Lets start with Nagios core installation. Download latest nagios
core service from official site.

# cd /opt/
# wget
# tar xzf nagios-4.1.1.tar.gz
# cd nagios-4.1.1
# ./configure --with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-config
# make install-commandmode

Now use below command to setup apache configuration for Nagios installation.

# make install-webconf

Step 4: Configure Apache Authentication

We need to setup apache authentication for user Nagios admin. Do not change this username. else you would required more
changes in configuration.

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

Now restart Apacheservice to make the new settings take effect.

# service httpd restart

Step 5: Install Nagios Plugins

After installing and configuring Nagios core service, Download latest nagios-plugins
source and install using following commands.

# cd /opt
# wget
# tar xzf nagios-plugins-2.1.1.tar.gz
# cd nagios-plugins-2.1.1

Now compile and install nagios plugins

# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make install

Step 6: Verify and Start Nagios

Use the following commands to verify nagios install and start nagios core service.

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# service nagios start

Also configure nagios service to start on system start

# chkconfig --add nagios
# chkconfig nagios on

Step 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 orip]

Prompting for Apache Authentication Password –

 nagios login page -Shree Niraula


Nagios After login screen –

nagios home page - Shree Niraula

 Now you have successfully installed and configured Nagios core service in your system.   This much for Step 1 Installation of Nagios core 4.1.1. Please stay in touch for further information. 

Share This