Install Nagios under CentOS detailed introduction
First, installation environment 1.CentOS 6.5 64-bit 2.nagios-4.3.2 3.nagios-plugins-2.2.1
Second, installation steps
1.su root #切换到 root user
2.yum install-y gcc glibcglibc-common gd gd-devel xinetd openssl-devel httpd PHP Unzip Perl
- Vim/etc/selinux/config
#关闭防火墙, change selinux=enforcing to selinux=disabled, and then restart. /usr/sbin/sestatus–v #查看防火墙状态, if prompted as follows, indicating the success of the shutdown.
4. Set up users and user groups
[Email protected]/]# useradd-s/sbin/nologin Nagios
[Email protected]/]# Mkdir/usr/local/nagios
[Email protected]/]# chown-r Nagios.nagios/usr/local/nagios
and add Nagios and Apache users to the Nagcmd group to ensure that Nagios and Apache have access
Groupadd nagcmdusermod-g nagcmd nagiosusermod-g nagcmd Apache
5. Download and install Nagios
#wget https://assets.nagios.com/downloads/nagioscore/releases/nagios4.3.2.tar.gz
TAR-ZXVF NAGIOS-4.3.2.TAR.GZCD nagios-4.3.2
#./configure--prefix=/usr/local/nagios--with-command-group=nagcmd
Make Allmake installmake install-init #初始化脚本make install-config #示例配置文件make install-commandmode #设置目录权限 If the installation is complete, use the command: LS /usr/local/nagios//ability to see these directories under the/usr/local/nagios directory (bin etc sbin share var) indicates that Nagios was installed successfully. Make install-webconf #安装完成以后是默认安装到 The directory of Apache's CONF.D.
6. Use Apache to create a basic Web page authentication method
Htpasswd-c/usr/local/nagios/etc/htpasswd.users Admin
#回车后会提示输入两次密码, see the following prompt, indicating that the account settings are successful (account: admin, password to keep in mind, page login required)
7. Start the service
[[Email protected] nagios-4.3.2]# service httpd restart #启动 httpd Services stopping httpd: [OK] starting httpd: [OK]
[Email protected] nagios-4.3.2]# chkconfig--level 235 httpd on #设置开机启动
8. Download and install the Nagios-plugins plugin
[[email protected]] #wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
[Email protected] nagios-4.3.2]# TAR-ZXVF nagios-plugins-2.2.1.tar.gz
[Email protected] nagios-4.3.2]# CD nagios-plugins-2.2.1
[Email protected] nagios-plugins-2.2.1]#/configure--prefix=/usr/local/nagios--with-nagios-user=nagios-- With-nagios-group=nagios
#make
Make install
#chkconfig--add Nagios
#chkconfig Nagios on//Set boot up
9. Check the correctness of the configuration file
[Email protected] nagios-plugins-2.2.1]#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/n agios.cfg
10. Start the Nagios service
[[Email protected] nagios-plugins-2.2.1]# service Nagios start
[[Email protected] nagios-plugins-2.2.1]# service httpd start
Enter your account password in the browser input http://localhost/nagios pop-up window to open the homepage
Install Nagios under CentOS detailed introduction