1, 搭建 LAMP 环境并安装所需要的工具和库
yum -y install httpd PHP openssl-devel gcc gcc-c++
2, 整合 Apache 和 PHP=lamp
cat /etc/httpd/conf/httpd.conf | grep -v "^#"|grep -w "DirectoryIndex"
DirectoryIndex index.PHP index.html
- cat /etc/httpd/conf/httpd.conf | grep -w "AddType application/x-httpd-php .php"
- AddType application/x-httpd-PHP .PHP
- cat /var/www/HTML/index.PHP
- <?PHP
- phpinfo();
- ?>
- systemctl start httpd
ip 地址访问是否正常
3, 创建组和用户
- groupadd nagios
- useradd -g nagios nagios
4, 解压编译安装
- cd nagios-4.2.1/
- ./configure --prefix=/usr/local/nagios
- make all
- make install
- make install-init
- make install-config
- make install-webconf
- make install-commandmode
5, 生成 Nagios 网页认证文件并创建用户 用户名最好为: nagiosadmin
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
6, 启动 nagios 和 apache
- service httpd restart
- service nagios restart
7, 安装 Nagios-plugins 插件
- tar zxf nagios-plugins-2.1.2.tar.gz
- cd nagios-plugins-2.1.2/
- ./configure --prefix=/usr/local/nagios
- make
- make install
来源: http://www.bubuko.com/infodetail-3682976.html