先下載apache、nagios、nrpe等源代碼包。可以去我的115下載,也可以去官網下載。有的人認爲需要安裝PHP,不過我是沒有安裝。文件可以都放在一個目錄下,我用CRT上傳在/nagios目錄下。
1、 解壓apache
#tar zxvf httpd-2.2.20.tar
2、安裝apache
#cd httpd-2.2.20
#./configure --prefix=/usr/local/apache/ (安裝指定目錄,方便管理)
#make
#make install
apache已經安裝完成了,可以測試:http://ip。啓動/usr/local/apache/bin/apachectl restart 或者service httpd start (這裏若是啓動報錯了,可以去我的上一篇文章看。)
3、安裝 nagios用戶
#/usr/sbin/useradd -m nagios 添加一個名爲nagios 的用戶用以專門跑nagios
#passwd nagios 設置密碼
#/usr/sbin/groupadd nagcmd 添加nagcmd 用戶組,用以通過web 頁面提交外部控制命令
#/usr/sbin/usermod -a -G nagcmd nagios 將nagios 用戶加入nagcmd 組
#/usr/sbin/usermod -a -G nagcmd apache 將apache 用戶加入nagcmd 組
4、解壓Nagios文件
#tar zxvf nagios-3.3.1.tar
#cd nagios
#./configure --prefix=/usr/local/nagios/
#make all
#make install
#make install-init
#make install-commandmode
#make install-webconf
5、檢測安裝是否成功
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (如圖)
6、配置登錄web用戶
#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
#passwd nagiosadmin
7、安裝nagios-plugins
#tar nagios-plugins
#cd nagios-plugins
#./configure --prefix=/usr/local/nagios/
#make install
8、登錄
#service nagios restart
通過web界面查看nagios: http://ip/nagios
輸入:nagiosadmin 密碼:........
9、設置開機啓動
#chkconfig --add nagios
#chkconfig nagios on
#chkconfig --level 2345 httpd on
10、以上就是沒有安裝插件的配置。這樣就算安裝完成了nagios簡單的服務器
11、喜歡中文界面的(可選)
#tar xvf nagios-cn-3.2.3.tar
#cd nagios-cn-3.2.3
#./configure --prefix=/usr/local/nagios/
#make all
#make install
#make install-init
#make install-commandmode
注:若是安裝了中文包,無法登錄,再次輸入:安裝6的過程。
vi /usr/local/nagios/etc/objects/contacts.cfg 修改Email發送地址。
參考:http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html(官網文檔)
包下載 http://u.115.com/file/aqkkx6qw#
nagios-plugins-1.4.15.tar.gz
http://u.115.com/file/clss1ocv#
nagios-cn-3.2.3.tar.bz2
http://u.115.com/file/e655a2i4#
nagios-3.3.1.tar.gz
http://u.115.com/file/bhiikbba#
httpd-2.2.20.tar.gz
需要包的,若是過期了,你們請提醒!
下篇安裝插件!