1. 编译安装apache
./configure –prefix=/usr/local/php \ –with-apxs2=/usr/local/apache/bin/apxs \ –with-config-file-path=/usr/local/php \ –enable-mbstring=all –disable-debug –enable-opcache –enable-soap –enable-shmop –enable-sockets –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-bcmath –enable-exif –enable-mysqlnd –enable-xml –enable-inline-optimization –enable-zip –with-iconv –with-zlib –with-curl –with-mcrypt –with-gd –with-xmlrpc –with-openssl –with-mysql=mysqlnd –with-mysqli=mysqlnd –enable-ftp –with-jpeg-dir –with-freetype-dir –with-png-dir –with-bz2 –with-xpm-dir –enable-mbregex –enable-mbstring
2. 编译安装php
./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache246/bin/apxs –with-config-file-path=/usr/local/php –with-iconv-dir=/usr/local/libiconv1.14 –with-zlib –with-gd –with-mcrypt=/usr/local/libmcrypt-2.5.7 –with-mysql –with-mysqli –enable-mbstring –with-pcre-dir –with-pear=/usr/local/php/lib/php
3. DNAT测试
sudo /sbin/iptables -t nat -A PREROUTING -p tcp -d 192.168.0.246 –dport 80 -j DNAT –to-destination 192.168.85.224
4. 编译安装nagios
tar xvf nagios-4.6.1.tar.gz -C /usr/local/src/
cd /usr/local/src/nagios-4.6.1
groupadd nagcmd
useradd nagios
usermod -a nagcmd nagios
./configure –prefix=/usr/local/nagios –with-nagios-user=nagios –with-command-group=nagcmd –with-httpd-conf=/usr/local/apache246/conf/extra
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
make install-exfoliation
make install-classicui
cp -R contrib/eventhandlers /usr/local/nagios/libexec/ chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
/usr/local/nagios/bin/nagios -V /usr/local/nagios/etc/nagios.cfg /etc/init.d/nagios start
/etc/init.d/httpd246 start
5. 添加验证用户
/usr/local/apache246/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
6. 安装nagios-plugin
wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
tar xvf nagios-plugins-1.5.tar.gz -C /usr/local/src/
cd /usr/local/src/nagios-plugins-1.5/
./configure –with-nagios-user=nagios –with-nagios-group=nagios make make install
7. 使服务开机自启动
chkconfig –add nagios
chkconfig –level 35 nagios on
chkconfig –add httpd246
chkconfig –level httpd246 on
8. 在被监控的服务器上安装nrpe
wget http://jaist.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
tar xvf nrpe-2.15.tar.gz -C /usr/local/src/
cd /usr/local/src/nrpe-2.15