How to install Nagios on a Raspberry Pi

Become root user

# su


# sudo -i

Download required packages via YUM.

# apt-get install apache2 libapache2-mod-php5 build-essential libgd2-xpm-dev

Create Nagios User

# /usr/sbin/useradd -m -s /bin/bash nagios

Change “nagios” user password. Not required but optional

# passwd nagios

Now Create a group for allowing external comands via the WEB UI and then add both Nagios and Apache user to it.

# /usr/sbin/groupadd nagcmd
# /usr/sbin/usermod -a -G nagcmd nagios
# /usr/sbin/usermod -a -G nagcmd www-data

Now download Nagios Core and Plugins from Nagios website to the /tmp directory. Latest versions as of now are Download Nagios 4.1.1 & Download Nagios Plugins 2.1.1

Create a directory for Nagios downloads

# cd /tmp
# wget
# wget

Untar the downloaded files

# tar zxvf nagios-4.1.1.tar.gz
# tar zxvf nagios-plugins-2.1.1.tar.gz

And the you will get 2 folders with the name “nagios-4.1.1” & “nagios-plugins-2.1.1”

First we will start with Nagios Core Install.

Change directory to Nagios 4.1.1

# cd /tmp/nagios-4.1.1

Compile the source and install it. All the files would go into “/usr/local/nagios/”

# ./configure --with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
# make install-webconf

NOTE: If you come across an error while running install-webconf, please refer to the steps below.


/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
/usr/bin/install: cannot create regular file ‘/etc/httpd/conf.d/nagios.conf’: No such file or directory
Makefile:296: recipe for target 'install-webconf' failed
make: *** [install-webconf] Error 1

Run this command to successfully install-webconf.

# /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-enabled/nagios.conf

Next would be to create a user for loggng into Nagios WEB UI.

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

*nagiosadmin is the user for WEB UI. You can user your preffered name.

Once that is done need to restart the Apache Service

# /etc/init.d/apache2 reload

Now we need to install the Plugins for Nagios

Change directory to nagios-plugins-2.1.1

# cd /tmp/nagios-plugins-2.1.1

Then compile & install the plugins

# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make install

Then Make sure that Nagios service starts up on runtime/ when the system boots up.

# ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the install for any errors

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

If no errors reported then start the Nagios service.

# /etc/init.d/nagios start

You are now ready to login to Nagios Web Interface via the browser (recommended would be Firefox)


*Use your host IP or the hostname follwed by /nagios.

Leave a Reply

Your email address will not be published. Required fields are marked *