0% found this document useful (0 votes)
148 views26 pages

Documentati On: 1: Installing Virtual Box

The document provides steps to install Nagios on a Linux virtual machine for network monitoring. It involves installing Oracle VirtualBox on the host Windows system. Then installing a Linux distribution as the guest OS and configuring it. Nagios and required plugins are downloaded and compiled on the guest Linux system. The Nagios web interface is configured for remote access. Additional steps include sharing folders between the guest and host systems and modifying SELinux settings for the Nagios web interface to function properly.

Uploaded by

manishsingh137
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views26 pages

Documentati On: 1: Installing Virtual Box

The document provides steps to install Nagios on a Linux virtual machine for network monitoring. It involves installing Oracle VirtualBox on the host Windows system. Then installing a Linux distribution as the guest OS and configuring it. Nagios and required plugins are downloaded and compiled on the guest Linux system. The Nagios web interface is configured for remote access. Additional steps include sharing folders between the guest and host systems and modifying SELinux settings for the Nagios web interface to function properly.

Uploaded by

manishsingh137
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 26

Documentati

on
Hi ,
Following document will comprise all the aspects of NAGIOS
its requirements, installations, use, additional software or
hardware if required and problem faced.

We all use windows OS by default because of its user Friendly


nature and availability.
So for installing Nagios we will require a Linux Operating
System.

For that a VIRTUAL MACHINE is a perfect solution, so that


we can two or more OS on our system.

Tasks involved in the overall process are listed below-

1: Installing virtual Box (oracle’s virtual box in our case).

2. Installing Guest OS on Virtual box.

3: Installing and configuring Nagios and its pluggins on guest


system.

4: Installing Guest edition

5: sharing data between guest and host system

6: Installing a database (Oracle in our case)

we will go in details of all one by one

1: Installing virtual Box:


First objective is to install a virtual machine (oracle’s virtual
box) on our current OS.
Oracle’s Virtual Box is the best option because of it is freeware,
easy and powerful.
The link for downloading V Box(Virtual Box) is :
http://www.virtualbox.org/wiki/Downloads
or from
http://www.virtualbox.org.

Now just go for Virtual box 4.0 for windows host because you
have window as a host machine.

now to installing virtual box VirtualBox can be downloaded


from

Its installation is very simple we didn’t find problem in that,


prefer to install in a different drive (Other than your system OS
drive) so that all your guest stuff reside in a new drive.

2: Installing Guest OS in virtual box:


Now we have to install guest OS on virtual box ,for this get the
ISO image or a CD of the setup.

Steps involved are listed below-

1: click on the VirtualBox icon

2: After clicking the following window will open -


3: Now click on new button you will fin this screen

4: click next and you will find the following screen—


Now write the name of your OS in Name or select from options
OS Type i.e. Fedora, Red hat and click next

5: Now you have to select the amount of memory to be given to


the Virtual machine.
Depending on what guest operating systems you want to run,
you will need at least 512 MB of RAM (but probably more,
and the more the better). Basically, you will need whatever your
host operating system needs to run comfortably, plus the amount
that the guest operating system needs. So, if you want to run
Windows XP on Windows XP, you probably won’t enjoy the
experience much with less than 1 GB of RAM. If you want to
try out Windows Vista in a guest, it will refuse to install if it is
given less than 512 MB RAM, so you’ll need that for the guest
alone, plus the memory your operating system normally needs.
Select the memory and click next.
6: now we will following screen

Here we a select virtual hard disk for the virtual machine, it is


advised to create new hard disk for new OS.
So just click next button

7: You will see following screen

click next and then


Here it is recommended to click dynamic expanding storage so
that later on if we require more memory it expands. so click next
And

Here you have to allocate the memory for virtual hard disk. The
memory selected should be 10-15 GB. 8GB is minimum but
more memory should be allocated.

8 : Now following window will be encountered


This shows the status till now you have done ,just have to click
finish if every thing is fine .

Now Virtual machine has been created and is allocated with all
the initial requirements.

9: Click on START Button to start the V machine the


installation will start

you will encounter a run wizard click next you will encounter
the screen below
10: In this window click where arrow is shown and trace where
the setup (First if more than one) is on the hard disk and click
next

Now you will find following screen


11: click Install a new system or upgrade an existing system
now the installation will get start and you will get to the
following screen
Here you are recommended to press ok to diagnose the media
before installation, but you can skip the process as it will cause
nothing.

12 : keep clicking next and select English until you get into this

click basic storage device and click next if you see a screen
like following click reinitialise all.
This will fix all the problems occurred,

13: Now name your local host it is advisable to keep the default
and click next now select your time zone SELECT ASIA
COLKATA.

14: now chose your password in next window and click next to
see this window

Here of all the options you have to select the default options ie
Replace existing Linux systems although you can select any of
them as per need. Now again click next
15: On clicking next a popup will come which shows to make
some change click edit the files and click next.

16: clicking next will show


Click next without any changes you can do change later if they
required.

17: If you have a single installation file it will start other wise it
will ask your permission just click CONTINUE, And
installation will start.

18 : If setup is there in more than one file in between it will ask


for other setup. For that
go to
Devices  CD/DVD Devices  chose a virtual CD/DVD
virtual file..
And select the second setup and so on….
19 : Click Reboot and you will done with the installation.

20 : now you just have to configure the system so click forward


twice and you will reach to the window where you have to
CREATE USER .

Write your user name, give pass and click FORWARD

20: set the time and in next screen do let “DO NOT SEND MY
PROFILE “clicked.

This is how we install an OS on VIRTUAL BOX.

2: Installing and configuring Nagios and its


pluggins on guest system.

Now as we have installed Linux (fedora and Linux in our case).

We need just to install nagios on our system we just have to


follow following steps

1: Write
su-
and give your admin password.

2: Install required packages by using commands

yum install httpd php

yum install gcc glibc glibc-common

yum install gd gd-devel

NOTE : These will not work with Red hat Enterprise Linux as
we have to pay for these packags .
3: Create a new nagios user account and give it a password by
the commands –

/usr/sbin/useradd -m nagios
passwd nagios

4: Create a new nagcmd group for allowing external commands


to be submitted through the web interface. Add both the nagios
user and the apache user to the group.

/usr/sbin/groupadd nagcmd

/usr/sbin/usermod -a -G nagcmd nagios

/usr/sbin/usermod -a -G nagcmd apache

5: Create a directory for storing the downloads.

mkdir ~/downloads

cd ~/downloads

6: Download Nagios and the Plugins

Download the source code tarballs of both Nagios and the


Nagios plugins http://www.nagios.org/download/

wget
http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-
3.2.3.tar.gz
wget
http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagi
os-plugins-1.4.11.tar.gz

7: go to download

cd ~/downloads

8:Extract the Nagios source code tarball.


tar xzf nagios-3.2.3.tar.gz

cd nagios-3.2.3

9: Run the Nagios configure script, passing the name of the


group you created earlier like so:

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

10: Compile the Nagios source code.

make all

make install

make install-init

make install-config

make install-commandmode
11: Customize Configuration using commands although this can
be done later if required so it you can leave this step.

Basically here you have to write your email ID at the place


depicted in the file so avoid following this command.
vi /usr/local/nagios/etc/objects/contacts.cfg

NOTE : it is better to do these changes by going directly to file


following the path

12: Configure the Web Interface

12.1:: Install the Nagios web config file in the Apache conf.d
directory.

make install-webconf

12.2:: Create a nagiosadmin account for logging into the


Nagios web interface. Remember the password you assign to
this account - you'll need it later.

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

12.3:: Restart Apache to make the new settings take effect.

service httpd restart

13: Compile and Install the Nagios Plugins

13.1:: Extract the Nagios plugins source code tarball.


cd ~/downloads

tar xzf nagios-plugins-1.4.11.tar.gzcd

nagios-plugins-1.4.11
13.2:: Compile and install the plugins.

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

make

make install

14: Start Nagios

Add Nagios to the list of system services and have it


automatically start when the system boots.

chkconfig --add nagios

chkconfig nagios on

Verify the sample Nagios configuration files.

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

If there are no errors, start Nagios.

service nagios start

15: Modify SELinux Settings


15.1 Fedora and Red hat ships with SELinux (Security
Enhanced Linux) installed and in Enforcing mode by default.
This can result in "Internal Server Error" messages when you
attempt to access the Nagios CGIs.

getenforce

Put SELinux into Permissive mode.

setenforce 0

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/

chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

16 : Now you are done with the installation restart the system

17: Open your browser ,You should now be able to access the
Nagios web interface at the URL below. You'll be prompted for
the username (nagiosadmin) and password you specified earlier.

http://localhost/nagios/

nagios webpage will be seen


4: Share folder(data) between host and guest :

If you have to share folder or data between host and guest


system follow following steps.

First of all you have to install guest edition.Guest edition is


installed by following procedure

1. open the Linux Virtual Machine (Red hat Linux in my case)

2.Go to devices and select Install Guest Additions.

3. Now you will see a CD like folder on the desktop.

4. Now open terminal from Applications > Accessories >


Terminal (Applications > System Tools > Terminal (in some
Linux ))
5. Now type
for Ubuntu type : sudo su - or sudo -i
for Fedora and redhat type : su -

6. Enter the root password.

7. Type
cd /media/VBOXADDITIONS_4.0.0_69151/

VBOXADDITIONS_4.0.0_69151 is the name of folder in step 3

8. Type for redhat : sh ./VBoxLinuxAdditions.run

it will look like this :


[root@localhost VBOXADDITIONS_4.0.0_69151]# sh
./VBoxLinuxAdditions.run

Type for fedora : ./VBoxLinuxAdditions.run

9. It will now install the GuestAdditions


Verifying archive integrity... All good.
Uncompressing VirtualBox 4.0.0 Guest Additions for
Linux.........
VirtualBox Guest Additions installer
Your guest system does not seem to have sufficient OpenGL
support to enable
accelerated 3D effects (this requires Linux 2.6.27 or later in the
guest
system). This Guest Additions feature will be disabled.

Building the main Guest Additions module [ OK ]


Building the shared folder support module [ OK ]
Doing non-kernel setup of the Guest Additions [ OK ]
You should restart your guest to make sure the new modules are
actually used

Installing the Window System drivers


Installing X.Org 7.1 modules [ OK ]
Setting up the Window System to use the Guest Additions
[ OK ]
You may need to restart the hal service and the Window System
(or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services componen[ OK


]
[root@localhost VBOXADDITIONS_4.0.0_69151]#

Exit the terminal and restart the system to see the changes.

Now we are ready to share folder we just have to follow


following steps-

1. Go to settings in VirtualBox.
2. Now select Shared Folders and click on the Add Shared
Folder (or press Ins)

3. New window will open.

Select other and select the path for the folder to be shared with
the linux guest machine. (let us say we have shared a folder
named sharedhost and check the box auto mount in present.

All this has to be done in the host side.

4. Now start the Linux machine.

5. Open terminal, get root access and type:

#mkdir /mnt/sharedguest

sharedguest will be present in the mnt folder.

6. Now type:

#mount -t vboxsf sharedhost /mnt/sharedguest

This line you have to enter every time you login into the system.
Else we can add this line to rc.local file so that it initializes on
every restart.
For that type:

#gedit /etc/rc.local

now add

#mount -t vboxsf sharedhost /mnt/sharedguest

before

touch /var/lock/subsys/local
it should look like this

now restart the machine and check the mnt > sharedguest.

You might also like