Installing Nagios

Important: Installing and configuring Nagios is rather involved. You can't just compile the binaries, run the program and sit back. There's a lot to setup before you can actually start monitoring anything. Relax, take your time and read all the documentation - you're going to need it. Okay, let's get started...

Unpacking The Distribution

To unpack the Nagios distribution, type the following two commands at a shell prompt:

gunzip nagios-1.0.tar.gz
tar xf nagios-1.0.tar

If you downloaded the ZIP version of the distribution, type the following:


When you have finished executing these commands, you should find a nagios-1.0 directory that has been created in your current directory. Inside that directory you will find all the files that compromise the core Nagios distribution.

Create Installation Directory

Create the base directory where you would like to install Nagios as follows...

mkdir /usr/local/nagios

Create User/Group

You're probably going to want to run Nagios under a normal user account, so add a new user (and group) to your system with the following commands (these will vary depending on what OS you're running):

adduser nagios

Run the Configure Script

Run the configure script to initialize variables and create a Makefile as follows...

./configure --prefix=prefix --with-cgiurl=cgiurl --with-htmurl=htmurl --with-nagios-user=someuser --with-nagios-grp=somegroup

Compile Binaries

Compile Nagios and the CGIs with the following command:

make all

Installing The Binaries And HTML Files

Install the binaries and HTML files (documentation and main web page) with the following command:

make install

Installing An Init Script

If you wish, you can also install the sample init script to /etc/rc.d/init.d/nagios with the following command:

make install-init

You may have to edit the init script to make sense with your particular OS and Nagios installation by editing paths, etc.

Directory Structure And File Locations

Change to the root of your Nagios installation directory with the following command...

cd /usr/local/nagios

You should see five different subdirectories. A brief description of what each directory contains is given in the table below.

Sub-Directory Contents
bin/ Nagios core program
etc/ Main, resource, object, and CGI configuration files should be put here
sbin/ CGIs
share/ HTML files (for web interface and online documentation)
var/ Empty directory for the log file

Installing The Plugins

In order for Nagios to be of any use to you, you're going to have to download and install some plugins. Plugins are usually installed in the libexec/ directory of your Nagios installation (i.e. /usr/local/nagios/libexec). Plugins are scripts or binaries which perform all the service and host checks that constitute monitoring. You can grab the latest release of the plugins from the Nagios downloads page or directly from the SourceForge project page.

Setup The Web Interface

You're probably going to want to use the web interface, so you'll also have to read the instructions on setting up the web interface and configuring web authentication, etc. next.

Configuring Nagios

So now you have things compiled and installed, but you still haven't configured Nagios or defined objects (hosts, services, etc.) that should be monitored. Information on configuring Nagios and defining objects can be found here. There's a lot to configure, but don't let it discourage you - its well worth it.