Installation Requirements:
1. Pure and minimal installation of CentOS 7.3
2. Log in to the system using the root user
3 An IP address, the system can connect the public network
Install dependency packages and tools software
# yum install-y wget httpd php gcc glibc glibc-common gd gd-devel make NET-SNMP unzip
Download Nagios Core and Nagios Plugins
# cd/tmp
# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz
# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
Add Nagios Users and Groups
# Useradd Nagios
# Groupadd Nagcmd
# useradd-a-G Nagcmd Nagios
# usermod-a-G Nagios,nagcmd Apache
Installing Nagios Core
Unpacking the installation package
# tar ZXVF nagios-4.3.4.tar.gz
# tar ZXVF nagios-plugins-2.2.1.tar.gz
Go to the Nagios Core installation directory
# CD nagios-4.3.4
#./configure--with-command-group=nagcmd
Configuration Summary for Nagios 4.3.4 2017-08-24 * * *:
General Options:
-------------------------
Nagios Executable:nagios
Nagios User/group:nagios,nagios
Command User/group:nagios,nagcmd
Event Broker:yes
Install ${prefix}:/usr/local/nagios
Install ${includedir}:/usr/local/nagios/include/nagios
Lock File:/run/nagios.lock
Check Result directory: ${prefix}/var/spool/checkresults
Init Directory:/ETC/RC.D/INIT.D
Apache CONF.D Directory:/ETC/HTTPD/CONF.D
Mail Program:/bin/mail
Host Os:linux-gnu
Iobroker Method:epoll
Web Interface Options:
------------------------
HTML url:http://localhost/nagios/
CGI url:http://localhost/nagios/cgi-bin/
Traceroute (used by WAP):
Review the options above for accuracy. If They look okay,
Type ' make all ' to compile the main program and CGIs.
# make All
# make Install
# Make Install-init
# Make Install-config
# Make Install-commandmode
# Make Install-webconf
# 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
# Systemctl Start Nagios
# Systemctl Start httpd
Create a new WEB access user
# htpasswd–c/usr/local/nagios/etc/htpasswd.users Nagiosadmin
Installing Nagios Plugin
# cd/tmp
# tar ZXVF nagios-plugins-2.2.1.tar.gz
# CD nagios-plugins-2.2.1
#./configure--with-nagios-user=nagios--with-nagios-group=nagios
# make
# make Install
Setting up Nagios Boot service
# chkconfig--add Nagios
# chkconfig--level and Nagios on
# Systemctl Enable httpd
Configuring firewalls
# Firewall-cmd--permanent--add-service=http
# Firewall-cmd--reload
Accessing the Nagios Web interface
Http://<your.nagios.server.ip>/nagios
Refer to the official installation documentation:
Https://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf
This article is from "Wang Yun Shu" blog, please be sure to keep this source http://wyjs6.blog.51cto.com/465920/1963380
CentOS 7.3 installs Nagios 4.3.4 and Nagios Plugins 2.2.1