
So, this article we guide you to install Nagios Core 4 on your Ubuntu System. The upcoming commands are tested on Ubuntu 13.04 and you will see the screenshots of the same.
He we begin!
1. Install the Necessary Packages
First of all, login as the Superuser, update the packages and then install the dependencies required by Nagios.
sudo su -
apt-get update
apt-get install wget build-essential apache2 php5 openssl perl make php5-gd wget libgd2-xpm libgd2-xpm-dev libapache2-mod-php5 libperl-dev libssl-dev daemon
2. Create a User and a Group We are going to create a user 'nagios' using
useradd
command and a group 'naggrp' using groupadd
command, then add the user 'nagios' to the group 'naggrp'.sudo useradd nagios
sudo groupadd naggrp
sudo usermod -a -G naggrp nagios
3. Download the Nagios Core 4 Packagesudo wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.2.tar.gz
4. Unarchive the Tarballsudo tar -xvzf nagios-4.0.2.tar.gz
5. Compile the Source Codecd nagios-4.0.2/
./configure --with-command-group=naggrp
Result:6. Install the Programs
make all
Result:make install
Result:make install-init
Result:make install-config
Result:make install-commandmode
Result:make install-webconf
Result:7. Copy the 'eventhandlers' directory
cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
8. Create a User 'nagiosadmin'htpasswd -cm /usr/local/nagios/etc/htpasswd.users nagiosadmin
Result:9. Restart the Apache2 Service
service apache2 restart
OR
/etc/init.d/apache2 restart
10. Start the Nagios ServiceIf you try starting the nagios service at this stage, you will be faced with an error as follows:
sudo /etc/init.d/nagios start
/etc/init.d/nagios: 20: .: Can't open /etc/rc.d/init.d/functions
Result:The reason behind this is the init script. As a remedy, we create a file 'nagios.conf' in the
/etc/init/
directory and edit it as follows:description "nagios 4.x core"
start on filesystems
stop on runlevel [1246]
respawn
setuid nagios
setgid naggrp
console log
script
exec /usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg
end script
Now, start the nagios service and it should work smoothly.sudo /etc/init.d/nagios start
Result:11. Nagios Apache Configuration
cp /etc/apache2/conf.d/nagios.conf /etc/apache2/sites-available/nagios
ln -s /etc/apache2/sites-available/nagios /etc/apache2/sites-enabled/nagios
12. Check the Nagios Configuration/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Result:13. The Last Touch
sudo /etc/init.d/nagios start
If you click 'Services' on the left side, at this point of time, you will meet following situation, indicating that you will have to install Nagios Plugins in order to proceed. How to do that? We will see in the upcoming tutorial.
That's all for now !
During initial steps.
ReplyDeletesudo useradd nagios
what is the password for the user during initial set up?