1. Download and install Ubuntu
2. Download, install, and configure Apache
3. Download, install, and configure Nagios
Download and install Ubuntu:
* Download Ubuntu (I used version 8.10 of Ubuntu Desktop)
* In VMWare Server, I booted to the ISO image
* Choose "Install Ubuntu"
* Choose English as the language
* Choose Time Zone
* Keyboard
* Select the Guided (use entire disk) option
* Fill in the user and computer information
* Click Install
* Click Restart
Once Ubuntu is installed, you can begin installing the prerequisites.
All commands will be issued with sudo command. If you prefer, you can just su as root and run everything that way.
Download, install and Configure Apache
* sudo apt-get install build-essential :this will install some necessary compilers
* sudo apt-get install libgd2-xpm-dev :Install GD Libraries
* sudo apt-get install apache2 : Install Apache2
* sudo apt-get install php5-common php5 libapache2-mod-php5 :Install PHP for Apache2
Configure Apache to use PHP:
* Run in a terminal: sudo vim /etc/apache2/apache2.con
* Paste the following into the file:
DirectoryIndex index.html index.php index.cgi
* and restart the server with the command
sudo /etc/init.d/apache2 restart
At this point, build-essentials, libgd2-xpm-dev and Apache with PHP support should be installed. You can test this by opening a browser and going to http://localhost/ to test Apache.
To test PHP, create a new text file and enter
Save the file as test.php in your root web directory (should be /var/www). Then go to http://localhost/test.php and this should display the PHP version information in the browser.
If you can view the Apache start page and the PHP version info page, it's time to download and install Nagios.
If you can't view the Apache start page: check that all of the packages are installed and the Apache service is running.
If you can't view the PHP version info page: verify that PHP was installed.
Download, install, and configure Nagios
Change to your home directory:
cd ~/
Download the current version of Nagios: http://sourceforge.net/project/showfiles.php?group_id=26589:
sudo wget http://downloads.sourceforge.net/nagios/nagios-3.1.0.tar.gz?use_mirror=voxel
Download the current version of the Nagios Plugins: http://sourceforge.net/project/showfiles.php?group_id=29880:
sudo wget http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.13.tar.gz?use_mirror=voxel
Extract the Nagios tarball:
sudo tar -zxvf nagios-3.1.0.tar.gz
and change to the nagios-3.1.0 directory
cd nagios-3.1.0
Create a user to run the service and a group to run external commands:
* sudo useradd -m nagios
* sudo passwd nagios
* sudo groupadd nagcmd
* sudo usermod -a -G nagcmd nagios
* sudo usermod -a -G nagcmd www-data
Now install the Nagios tarballs that were downloaded previously:
* sudo ./configure --with-command-group=nagcmd
* sudo make all
* sudo make install
* sudo make install-init
* sudo make install-config
* sudo make install-commandmode
* sudo make install-webconf
Add a user for the Nagios interface:
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Add the directives to Apache for Nagios:
In a terminal type:
sudo vim /etc/apache2/apache.conf
Paste the text below into the conf file:
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Alias /nagios /usr/local/nagios/share
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
ServerName localhost
Restart Apache:
sudo /etc/init.d/apache2 restart
Extract and compile the plugins that were downloaded earlier:
* cd ~/
* tar -zxvf nagios-plugins-1.4.13.tar.gz
* cd nagios-plugins-1.4.13
* sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
* sudo make
* sudo make install
Create a link to start the service:
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
Verify the config:
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Start Nagios:
sudo /etc/init.d/nagios start
You should now be able to log into the Nagios web interface (http://localhost/nagios) using the nagiosadmin user and password.
This how-to is actually a combination of the Nagios official documentation (Ubuntu Quickstart), Albasit's Nagios/Ubuntu/VMWare how-to, and some of my own work in-between. I appreciate the help I got from all of these documents.
credit:: http://www.thedailyadmin.com/
No comments:
Post a Comment