How to install Nagios4.0 on centos6.4

Source: Internet
Author: User

1. Create nagios users and user groups

[Root @ Centos ~] # Useradd-s/sbin/nologin nagios

[Root @ Centos ~] # Mkdir/usr/local/nagios

2. Prepare the installation environment

[Root @ Centos ~] # Yum install-yphp httpd gcc glibc-common gd-devel php-mysql-serverphp-snmp php-pdo perl-DBD-MYSQL php-pear openssl-devel

3. Downloading and installing nagios 4.0

[Root @ Centos ~] # Cd/usr/local/

[Root @ Centos ~] # Wgethttp: // response

[Root @ Centos ~] # Tar-zxvf nagios-4.0.0.tar.gz

[Root @ Centos ~] # Chown-Rnagios. nagios/usr/local/nagios

[Root @ Centos ~] # Cd nagios

[Root @ Centos ~] #./Configure -- prefix =/usr/local/nagios

[Root @ Centos ~] # Make all

[Root @ Centos ~] # Make install

Note :{

Make install is used to install the main program of nagios, CGI and HTML files

Run the make install-init command to create a nagios STARTUP script in the/etc/rc. d/init. d directory.

Make install-commandmode command to configure Directory Permissions

The make install-cofig command is used to install the nagios sample configuration file. The installation path is/usr/local/nagios/etc.

Make install-webconf is used to install the apache configuration file for the nagios web interface.

}

[Root @ Centos ~] # Make install-init

[Root @ Centos ~] # Make install-commandmode

[Root @ Centos ~] # Make install-cofig

[Root @ Centos ~] # Make install-webconf

4. Install the nagios plug-in

[Root @ Centos ~] # Wgethttp: // response

[Root @ Centos ~] # Tar-zxvf nagios-plugins-1.4.16.tar.gz

[Root @ Centos ~] # Cd nagios-plugins-1.4.16

[Root @ Centos ~] #./Configure -- prefix =/usr/local/nagios

[Root @ Centos ~] # Make all & make install

5. Configure httpd and php

Modify the httpd configuration file/etc/httpd/conf/httpd. conf

Find the following two rows:

User apache

Group apache

Change

User nagios

Group nagios

Then find

DirectoryIndex index.htmlindex.html. var

Change

DirectoryIndex index.htmlindex.html. var index. php

Add the following lines under it:

AddTypeapplication/x-httpd-php. php

Add the following information at the end of the configuration file:

# Setting for nagios

ScriptAlias/nagios/cgi-bin "/usr/local/nagios/sbin"

<Directory "/usr/local/nagios/sbin">

AuthType Basic

Options ExecCGI

AllowOverride None

Order allow, deny

Allow from all

AuthName "NagiosAccess"

AuthUserFile/usr/local/nagios/etc/htpasswd

Require valid-user

</Directory>


Alias/nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">

AuthType Basic

Options None

AllowOverride None

Order allow, deny

Allowfrom all

AuthName "nagiosAccess"

AuthUserFile/usr/local/nagios/etc/htpasswd

Require valid-user

</Directory>


ServerName nagios: 80

Save configuration file

6. Configure the hosts file

Because I do not have an internal DNS server, I can only edit the hosts file

7. Start the httpd service

Service httpd start

8. Add a verification file

[Root @ Centos nagios] #/usr/bin/htpasswd-c/usr/local/nagios/etc/htpasswd Arthur

New password: (enter the password)

Re-type new password: (enter the password again)

Adding password for user Arthur

An htpasswd verification file is added under/usr/local/nagios/etc.

9. Add nagios to the startup service option.

Chkconfig -- level 35 nagioson

10. Start the nagios Service

/Etc/rc. d/init. d/nagios start or service nagios start

11. Disable SELINUX and IPTABLES

Setenforce 0

Service iptables stop

This is a temporary shutdown. It will be enabled again after restart!

12. Access nagios

Enter the nagios/nagios account in the browser, and then enter the new arthur account and password of the Account. The long-overdue page is displayed.



This article is from the "Xie haitang" blog, please be sure to keep this source http://xiehaitang.blog.51cto.com/4914337/1301145


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.