一、安装Nagios所需组件(事先需配置好yum环境)

# yum -y install httpd php gcc glibc glib-common gd gd-devel libpng libjpeg zlib

二、安装Nagios(软件包位置:http://down.51cto.com/data/1906099)

1、解压软件包

# tar -zxf nagios-3.2.1.tar.gz -C /usr/local/

# cd /usr/local/nagios-3.2.1/

可以参照帮助文档:file:///usr/local/nagios-3.2.1/html/docs/quickstart.html

2、创建Nagios运行用户

# useradd -m nagios

# passwd nagios

# groupadd nagcmd

# usermod -a -G nagcmd nagios

# usermod -a -G nagcmd apache

3、源码包编译安装

# cd /usr/local/nagios-3.2.1/

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

# make all

# make install

# make install-init

# make install-config

# make install-commandmode

# make install-webconf

4、创建nagios登陆密码

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

5、重新启动Apache

# service httpd restart

# chkconfig httpd on

三、安装nagios插件

# tar -zxf nagios-plugins-1.4.14.tar.gz

# cd nagios-plugins-1.4.14

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

# make

# make install

四、将nagios加入到系统服务中使其开机自启动,并启动nagios

# chkconfig --add nagios

# chkconfig nagios on

# service nagios start

五、Nagios使用手册在源码包/html/docs/目录下为Web方式