[iyunv@cache-2 nagios-4.0.6]# ./configure --with-command-group=nagios --prefix=/opt/app/nagios --enable-embedded-perl --with-httpd-conf=/usr/local/apache2/conf
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
.............................
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /bin/traceroute
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
5 開始make安装
5.1 make all
[iyunv@cache-2 nagios-4.0.6]# make all
cd ./base && make
make[1]: Entering directory `/root/nagios-4.0.6/base'
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o nagios.o nagios.c
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o broker.o broker.c
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o nebmods.o nebmods
.........................
For more information on obtaining support for Nagios, visit:
http://support.nagios.com
*************************************************************
Enjoy.
5.2 make install
[iyunv@cache-2 nagios-4.0.6]# make install
cd ./base && make install
make[1]: Entering directory `/root/nagios-4.0.6/base'
make install-basic
make[2]: Entering directory `/root/nagios-4.0.6/base'
.....................................................
make[2]: Entering directory `/root/nagios-4.0.6/cgi'
for file in *.cgi; do \
/usr/bin/strip /usr/local/nagios/sbin/$file; \
done
[iyunv@cache-2 nagios-4.0.6]# make install-commandmode
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
*** External command directory configured ***
Remember, these are *SAMPLE* config files. You'll need to read
the documentation for more information on how to actually define
services, hosts, etc. to fit your particular needs.
開始安装:
tar -xvf httpd-2.4.7.tar.gz
cd httpd-2.4.7
./configure --prefix=/usr/local/apache2
make && make install
[iyunv@cache-2 ~]# tar -xvf httpd-2.4.7.tar.gz
[iyunv@cache-2 ~]# cd httpd-2.4.7
[iyunv@cache-2 httpd-2.4.7]# ./configure --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
Google之后,发现可能是gcc版本号太低了,可能是apache版本号太高,换低点的2.2.23版本号吧。
wget http://archive.apache.org/dist/httpd/httpd-2.2.23.tar.gz
tar -xvf httpd-2.2.23.tar.gz
cd httpd-2.2.23
./configure --prefix=/usr/local/apache2
make && make install
(2) 安装php版本号
wget http://cn2.php.net/distributions/php-5.4.26.tar.gz
tar -xvf php-5.4.26.tar.gz
cd php-5.4.26
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs
有报错信息:
Configuring extensions
checking size of long... (cached) 8
checking size of int... (cached) 4
checking for int32_t... yes
checking for uint32_t... yes
checking for sys/types.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for strtoll... yes
checking for atoll... yes
checking for strftime... (cached) yes
checking which regex library to use... php
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
为了安全起见:nagios的web监控页面须要经过授权才干訪问,这须要添加�验证配置,即在httpd.conf 文件最后加入�例如以下信息:
#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 "Nagios Access"
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
Allow from all
AuthName "nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
</Directory>
(4) 创建apache文件夹验证文件
在上面的配置中,指定了文件夹验证文件htpasswd,以下要创建这个文件:
/usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd david
[iyunv@cache-2 php-5.4.26]# /usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd david
New password:
Re-type new password:
Adding password for user david
查看认证文件的内容:
[iyunv@cache-2 php-5.4.26]# cat /usr/local/nagios/etc/htpasswd
david:$apr1$Pf9XIJjd$m5hR2vw70MlqwrChgN7zc/
[iyunv@cache-2 php-5.4.26]#
[iyunv@cache-2 php-5.4.26]# /usr/local/apache2/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 10.254.3.41 for ServerName
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
改动ServerName以及Port
vi /usr/local/apache2/conf/httpd.conf
ServerName 改成 10.xx.3.x1
Listen 80 改成 Listen 81