Showing posts with label nagios linux. Show all posts
Showing posts with label nagios linux. Show all posts

Saturday, July 23, 2016

Installing Nagios Core without "root" permission

Complete guide to install Nagios in Linux without "root" permission

1) Installing HTTPD

# All the installation will be done under /home/maximus/tools

wget http://www-eu.apache.org/dist//httpd/httpd-2.4.23.tar.gz
wget http://www-eu.apache.org/dist//apr/apr-util-1.5.4.tar.gz
wget http://www-eu.apache.org/dist//apr/apr-1.5.2.tar.gz

tar -xzvf httpd-2.4.23.tar.gz
tar -xzvf apr-1.5.2.tar.gz
tar -xzvf apr-util-1.5.4.tar.gz

cp -r apr-1.5.2 httpd-2.4.23/srclib/apr
cp -r apr-util-1.5.4 httpd-2.4.23/srclib/apr-util
cd httpd-2.4.23
./configure --prefix=/home/maximus/tools -with-included-apr
make
make install

2) Install PHP

wget http://php.net/get/php-7.0.9.tar.gz
tar -xzvf php-7.0.9.tar.gz
cd php-7.0.9
./configure --prefix=/home/maximus/tools --with-apxs2=/home/maximus/tools/bin/apxs --with-config-file-path=/home/maximus/tools/conf/
make
make install
cp php.ini-development /home/maximus/tools/conf/php.ini

# Add the following lines in /home/maximus/tools/conf/httpd.conf to enable PHP and CGI, 
# and to change the default HTTP port no

Listen 5555
LoadModule cgid_module modules/mod_cgid.so
LoadModule php7_module        modules/libphp7.so
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

3) Install GD

wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
tar -xzvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/home/maximus/tools/
make
make install


4) Install Nagios

wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
tar -xzvf nagios-4.1.1.tar.gz
cd nagios-4.1.1

# maximus is a non-previliged user. eng is the group which maximus belongs to. 
# Feel free to change it as per your needs
./configure --prefix=/home/maximus/tools/nagios --with-cgiurl=/nagios/cgi-bin --with-htmurl=/nagios/ --with-nagios-user=maximus --with-nagios-group=eng --with-command-group=eng --with-gd-lib=/home/maximus/tools/lib --with-gd-inc=/home/maximus/tools/include --with-httpd-conf=/home/maximus/tools/conf
make all
make install

# In the Makefile (in current directory) add the entry DESTDIR=/home/maximus/tools/ 
# and the execute the next command
make install-init
# Now remove the entry which we just added
make install-commandmode
make install-config
make install-webconf
cp -R contrib/eventhandlers/ /home/maximus/tools/nagios/libexec/

# Provide a password for the user nagiosadmin (you can chose your own username). 
# You will be using this login to the Nagios Core Web 
cd /home/maximus/tools/nagios/etc/
htpasswd -c htpasswd.users nagiosadmin

# Add the following line to /home/maximus/tools/conf/httpd.conf

Include conf/nagios.conf

5) Install the Nagios Core Plugins

wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
tar -xzvf nagios-plugins-2.1.1.tar.gz
cd nagios-plugins-2.1.1
./configure --with-nagios-user=maximus --with-nagios-group=eng --prefix=/home/maximus/tools/nagios/
make
make install

To start the all the services
/home/maximus/tools/bin/apachectl start
/home/maximus/tools/etc/rc.d/init.d/nagios start

To stop the all the services
/home/maximus/tools/bin/apachectl stop
/home/maximus/tools/etc/rc.d/init.d/nagios stop

Web Address
http://localhost:5555/nagios/index.php

Hope this helps!!