Installing Nagios 3.1.2.0 on CentOS 5.3 : Part-1
Author:Badi Ul Zaman email:bnhashmi at wbitt dot com
Part I: Installing Nagios 3.1.2.0 on CentOS 5.3
Step # 1 Checking for Prerequisites.
yum list installed | egrep 'httpd|gcc|glibc|glibc-common|gd|gd-devel'
compat-gcc-34.i386 3.4.6-4 installed
compat-gcc-34-c++.i386 3.4.6-4 installed
compat-gcc-34-g77.i386 3.4.6-4 installed
compat-glibc.i386 1:2.3.4-2.26 installed
compat-glibc-headers.i386 1:2.3.4-2.26 installed
compat-libgcc-296.i386 2.96-138 installed
gcc.i386 4.1.2-44.el5 installed
gcc-c++.i386 4.1.2-44.el5 installed
gcc-gfortran.i386 4.1.2-44.el5 installed
gcc-gnat.i386 4.1.2-44.el5 installed
gcc-java.i386 4.1.2-44.el5 installed
gcc-objc.i386 4.1.2-44.el5 installed
gd.i386 2.0.33-9.4.el5_1.1 installed
gd-devel.i386 2.0.33-9.4.el5_1.1 installed
gdb.i386 6.8-27.el5 installed
gdbm.i386 1.8.0-26.2.1 installed
gdbm-devel.i386 1.8.0-26.2.1 installed
gdk-pixbuf.i386 1:0.22.0-25.el5 installed
gdm.i386 1:2.16.0-47.el5.centos installed
glibc.i686 2.5-34 installed
glibc-common.i386 2.5-34 installed
glibc-devel.i386 2.5-34 installed
glibc-headers.i386 2.5-34 installed
httpd.i386 2.2.3-22.el5.centos installed
libgcc.i386 4.1.2-44.el5 installed
sysklogd.i386 1.4.1-44.el5 installed
Above output shows that required packages are installed on system. In the case the are not installed you can install them using your CentOS 5.3 DVD. If you want to install from CentOS 5.3 DVD you need to enable CentOS-Media.repo
Enabling CentOS-Media.repo
vim /etc/yum.repos.d/CentOS-Media.repo
CentOS-Media.repo
This repo is used to mount the default locations for a CDROM / DVD on CentOS-5. You can use this repo and yum to install items directly off the DVD ISO that we release. To use this repo, put in your DVD and use it with the other repos too:
yum --enablerepo=c5-media [command]
or for ONLY the media repo, do this:
yum --disablerepo=\\\\\* --enablerepo=c5-media [command]
[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///media/dvd/
file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Step # 2 Installing Prerequisites.
yum --disablerepo=\\\\\* --enablerepo=c5-media -y install httpd gcc glibc glibc-common gd gd-devel
Step # 3 Creating Users/Groups needed.
groupadd nagcmd
useradd -G nagcmd,apache nagios
id nagios
passwd nagios
Step # 4 Downloading Nagios & Plugins
mkdir /downloads
cd /downloads
wget -c http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.1.2.tar.gz
wget -c http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
Step # 5 Extracting Nagios tar ball.
tar zxvf nagios-3.1.2.tar.gz
cd nagios-3.1.2
Step # 6 running ./configure script.
./configure –with-command-group=nagcmd
Step # 7 compiling the source code.
make all
Step # 8 Installing Nagios binaries.
make install
Step # 9 Installing init script.
make install-init
Step # 10 Installing sample config files.
make install-config
Step # 11 setting permissions on the external command directory.
make install-commandmode
Step # 12 Updating contacts/groups information in contacts.cfg file.
vim /usr/local/nagios/etc/objects/contacts.cfg change email address of nagiosadmin user line 35 according to your requirements.
Step # 13 Installing web configuration.
make install-webconf
Step # 14 creating nagiosadmin user and setting password for web-interface.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Step # 15 Configuring, Restarting Apache Service and Adding to runlevel 35 .
vim /etc/httpd/conf/httpd.conf go to line 391 and add index.php chkconfig –level 35 httpd on service httpd restart
Step # 16 Compiling and installing Nagios plugins.
cd /downloads/ tar zxvf nagios-plugins-1.4.13.tar.gz cd nagios-plugins-1.4.13 ./configure –with-nagios-user=nagios –with-nagios-group=nagios make
make install
Step # 17 Verifying, restarting nagios service and Adding to runlevel 35 .
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg chkconfig –level 35 nagios on Changing nagios user home directory to /usr/local/nagios usermod -d /usr/local/nagios/ nagios service nagios restart ps aux | grep nagios
Step # 18 Modifying SeLinux Setting for Nagios
chcon -R -t httpd\_sys\_content\_t /usr/local/nagios/sbin/
chcon -R -t httpd\_sys\_content\_t /usr/local/nagios/share/
Step # 19 Login to Web-Interface.
Http://localhost/nagios
Step # 20 Check for Nagios Logs
tail -f /usr/local/nagios/var/nagios.log
Now we are done with Nagios Installation Part-I Alhamdulillah.