How To Install Nagios on Centos Linux Virtual Machine

 
This tutorial will guide you about how to install Nagios on CentOS linux Cloud server.

 

1st Step: First of all we have to install the epel repository with the given command.

yum install epel-release

We should install the httpd, php libraries, and other php libraries too however we will get to that later.

 

web hosting VPS for India

 

2nd Step. Few of you might get an issue as follows:

Another app is currently holding the yum lock; waiting for it to exit…..

In order to fix this issue, you need to kill the pid along with the kill command.

Assume the pid=14484 at that point here's the means by which you can kill that process.

kill 14484

kill 14484

Then enter cleae in the terminal window and install the epal repository once again - Linux Cloud Server.

yum install epel-release

In case another app issue persists you can continue killing the process and then run the given command again.

It does not occur frequently however when it does you comprehend what to do now.

Once you are done with this, and you install epel-release it will let you know how much download as well as install space the repository is going to require.

On the off chance that you meet the prerequisites at that point enter "Y" and afterward hit enter.

After that you will be again requested to put Y/N for an inquiry Is this okay [Y/N]:

Now it will ask you regardless of whether you need to install the key.

Enter "y" and press enter again.

Since you have effectively installed the repository. you can at last begin with installation of nagios on centos Linux Cloud server.

3rd Step: As we will utilize and install it on centos Linux Cloud server, we have to install the httpd as well as php packages.

yum install -y httpd php

When we have installed the dependencies we can proceed onward to the libraries.

yum install -y gcc glibc glibc-common make gd gd-devel net-snmp

It may require some time to install, refresh and clean.

4th Step: Now we have to add Nagios user to the system so that you do not need to run it as a root user.

useradd nagios

Presently, include another nagcmd group. The reason for this group command is to permit you run outer commands utilizing the web interface.

 

linux VPS hosting India best

 

groupadd nagcmd

After that add usermod.

usermod -G nagcmd nagios

usermod -G nagcmd apache

5th Step: Once we have set up the use. We can being with download and installation section.

Prior we download the installation package, first we have to create fresh directory to store the packages.

mkdir ~/nagios

cd ~/nagios

Now obtained the most recent version of nagios utilizing wget command as given below:

wget https://sourceforge.net/projects/nagios/files/nagios-4.x/nagios-4.3.4/nagios-4.3.4.tar.gz/download

Once you are done downloading nagios, you can download nagios plugins.

wget http://www.nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz

6th Step: Since you have successfully downloaded the packages you have to remove the content utilizing following commands.

tar zxvf nagios-4.3.4.tar.gz

tar zxvf nagios-plugins-2.2.1.tar.gz

7th Step: Subsequent stage includes compiling and installing the documents furthermore, for that we should set the present directory to nagios 4.3.4.

cd nagios-4.3.4

Presently run the ./configure command. This commands generally discovers the whereabout of the compiler.

./configure --with-command-group=nagcmd

We need to use the following commands in order to install and compile the nagios files.

make all

The command given below will copy the files to right locations.

make install

make install

8th Step: Now we will install the init script.

make install-init

Result.

**** Init script installed *****

At present install the files that you need to run Nagios from the command line interface.

make install-commandmode

Result.

**** External command directory configured ****

At the end we require to install the sample configuration file.

make install-config

Result.

**** Config files installed ****

To gain admittance to the online interface of nagios we have to install the component of nagios.
make install-webconf

Result.

**** Nagios/Apache conf file installed ****

 

windows VPS hosting India best

 

9th Step: Now we are going to set up a password for nagosadmin

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

 

Result:

New password:

Re-type new password:

To view all the modification in effect you need to restart apache.

systemctl start httpd.service

10th Step: That finishes up the nagios web component part currently it's a great opportunity to configure the plugins.

Begin by just setting the plugin as the present directory.

cd ~.nagios/nagios-plugins-2.2.1

Following steps will appear to be familiar as we effectively utilized them once to install nagios. Presently we will utilize them to install nagios plugins.

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

This will take pretty much a moment or two. When it is done utilize the accompanying commands.

make

make install

11th Step: To guarantee that nagios begins at boot time we will execute the accompanying commands.

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

12th Step: In the event that everything runs well then with the accompanying commands you can add the service to run nagios on boot.

chkconfig --add nagios

chkconfig --level 35 nagios on

Now begin the service.

systemctl start nagios.service

13th Step: Now you will need the IP address of your device in this step.

Run the command given below in the terminal window.

cd

Ifconfig

Open the web browser of your system and type the link given below:

http:/yourserveripaddress/nagios

Don’t forget to replace yourserveripaddress with your actual IP address. And press enter.

Once you press enter you will be asked for login credentials.

Put your username and password that you assigned.

Now it will take you to the Nagios home page, from where you can easily monitor your centos.

You you have successfully installed Nagios on your Linux Cloud Server.