Please note these are more notes for me than a finished write-up, however I hope to document this on the Nagios WIKI in due course…

Install the dependencies

aptitude install build-essential gcc libgd2-xpm-dev libglib2.0-dev make

accept defaults for the dpkg-config

Create the users and groups that are required:

/usr/sbin/useradd nagios

passwd nagios

/usr/sbin/groupadd nagcmd

/usr/sbin/usermod -G nagcmd nagios

/usr/sbin/usermod -G nagcmd www-data

Change to a directory to install the source

cd /usr/local/src/

Download sources (latest versions available from http://www.nagios.org/download)

wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.2.tar.gz
wget http://switch.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.12.tar.gz

Untar sources

tar xzf nagios-3.0.2.tar.gz
cd nagios-3.0.2

Configure the basic setup of Nagios

./configure –with-command-group=nagcmd

Compile Nagios

make all

Install binaries, init script, sample config files and set permissions on the external command directory.

make install

make install-init

make install-config

make install-commandmode

Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.

vi /usr/local/nagios/etc/objects/contacts.cfg

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

make install-webconf

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

Restart Apache to make the new settings take effect.

/etc/init.d/apache2 restart

Extract the Nagios plugins source code tarball.

cd /usr/local/src

tar -zxvf nagios-plugins-1.4.12.tar.gz

Change to the plugins dir

cd nagios-plugins-1.4.12

Compile the plugins

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

make

make install

Start Nagios on boot:

update-rc.d nagios defaults

Verify the configs:

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

Start Nagios

/etc/init.d/nagios start

Browse to the web interface and log in!