一、安装apache和php
1.安装apache
./configure --prefix=/usr/local/apache --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make
make install
2.安装php
'./configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache/bin/apxs' '--enable-fpm' '--enable-mbstring' '--with-mysql' '--with-pdo-mysql' '--enable-pdo' '--with-curl' '--with-gd' '--enable-zip' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--enable-opcache' '-with-snmp' '--enable-sockets'
make
make install
3.apache支持php
vi httpd.conf
AddType application/x-httpd-php .php
二、安装nagios-core和nagios-plusin
1.创建nagios用户
#useradd -m nagios
#groupadd nagcmd
#usermod -a -G nagcmd nagios
#usermod -a -G nagcmd apache
2.编译安装
#tar xvf nagios-4.2.4.tar.gz
#cd nagios-4.2.4
#./configure prefix=/usr/local/nagios --with-command-group=nagcmd --with-nagios-user=nagios --with-nagios-group=nagios --enable-event-broker
#make all
#make install
#make install-init (生成init启动脚本)
#make install-config (生成一些模板配置文件)
#make install-commandmode (设置相应的权限)
#make install-webconf (生成Apache配置文件nagios.conf)
3.为Nagios设置Web验证的密码
#/usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.user nagiosadmin
4.设置Nagios的开机启动
chkconfig --add nagios
chkconfig nagios on
5.安装Nagios的插件nagios-plugins
#tar zxvf nagios-plugins-2.1.4.tar.gz
#cd nagios-plugins-2.1.4
#./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-mysql
#make
#make install
6.编辑httpd配置文件
vi /usr/local/apache/conf/httpd.conf
include /etc/httpd/conf.d/nagios.conf
7.启动nagios和httpd 进入nagios