set-variable=max_connections=1000
set-variable=max_user_connections=500 set-variable=wait_timeout=200 将Mysql进程杀死,再重新跑Mysql 86 killall mysqld 90 /usr/local/mysql/bin/mysqld_safe--user=mysql& 检查3306端口是否开启 92 netstat -an |grep 3306 94 /usr/local/mysql/bin/mysqladmin -uroot -pvariables |grep max 再查看最大连接数,看刚才的修改是否生效 二:安装Apache 将Apache进行解压 97 tar -xzvf httpd-2.2.8.tar.gz 98 cd httpd-2.2.8 进行配置环境,编译和安装 102 ./configure --prefix=/usr/local/apache2--enable-so 103 make;make install 修改Apache配置文件,将ServerName去掉注释并将后面改成本机IP 104 vi /usr/local/apache2/conf/httpd.conf 测试一下Apache配置文件的语法 106 /usr/local/apache2/bin/apachectl �Ct 启动Apache 107 /usr/local/apache2/bin/apachectl -kstart& 将Apache添加到自动启动中 108 echo '/usr/local/apache2/bin/apachectl -kstart&'>>/etc/rc.d/rc.local 检查Apache的端口是否跑起来了 111 netstat -an |grep 80 三:安装Gd 使用Yum安装好GDjpeg libpng freetype 等 113 yum -y update zlib-devel zlib libpng-devellibpng freetype-devel freetype libjpeg-devel libjpeg fontconfig-develfontconfig libxml2-devel libxml2 libxml2-python gd-devel gd 四:安装Php 接下来将Php进行解压 116 tar -xzvf php-5.2.5.tar.gz 117 cd php-5.2.5 配置Php之前要拷贝这个文件才行 119 cp /usr/include/gd.h /usr/lib/gd.h 将Php进行配置,编译和安装 121 ./configure --prefix=/usr/local/php5--with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql--with-gd=/usr/lib --with-freetype-dir --with-png-dir --with-jpeg-dir--with-zlib --enable-gd-jis-conv --enable-xml --enable-sockets 122 make 123 make install 将源模板配置拷贝到目的路径下 124 cp php.ini-recommended/usr/local/php5/lib/php.ini 编辑Apache配置文件 126 vi /usr/local/apache2/conf/httpd.conf 查找AddType application/x-compress .Z AddType application/x-gzip .gz .tgz 在其下加入 AddType application/x-tar .tgz AddType application/x-httpd-php .php AddType image/x-icon .ico 修改DirectoryIndex 行,添加index.php 修改为DirectoryIndex index.php index.html
然后进入Apache的Document目录下建立一个Php文件 132 cd /usr/local/apache2/htdocs/ 133 vi index.php Index.php内容如下 <?php Phpinfo(); ?> 将Apache关闭再重新启动 135 /usr/local/apache2/bin/apachectl -k stop 136 /usr/local/apache2/bin/apachectl -k start
五:安装Rrdtool 首先将libart_lgpl-devel使用Yum安装好(Rrdtool安装需要) 39 yum install libart_lgpl-devel 将Cgilib解压 143 tar -xzvf cgilib-0.5.tar.gz 144 cd cgilib-0.5 将Cgilib编译,但不要安装 146 make 将这两个文件复制到库目录下(安装Rrdtool时需要) 150 cp cgi.h /usr/include/ 151 cp libcgi.a /usr/local/lib 将Rrdtool进行解压 154 tar -xzvf rrdtool.tar.gz 把Rrdtool进行配置,编译和安装 157 ./configure --prefix=/usr/local/rrdtool 158 make 159 make install
六:安装Nagios 将Nagios进行解压 163 tar -xzvf nagios-2.12.tar.gz 164 cd nagios-2.12 进行配置,并安装(根据提示),不过先要建立好Nagios用户和Nagios目录 167 ./configure --prefix=/usr/local/nagios 168 make all 170 useradd nagios 171 mkdir /usr/local/nagios 172 chown nagios.nagios /usr/local/nagios 173 clear 174 make install 175 make install-init 176 make install-commandmode 177 make install-config 安装Nagios插件,将插件进行解压 181 tar -xzvf nagios-plugins-1.4.11.tar.gz 182 cd nagios-plugins-1.4.11 将Nagios插件进行配置,编译和安装 184 ./configure --prefix=/usr/local/nagios 185 make 186 make install 安装Nagios-snmp的插件 188 tar -xzvf nagios-snmp-plugins.1.1.1.tgz 189 cd nagios_plugins/ 查看安装说明 191 vi README 首先要安装好Cpan,参考站点:[url]http://gzmaster.blog.51cto.com/299556/66897[/url] 192 perl -MCPAN -e shell 如果已经满足安装条件的话,再执行install这个脚本 194 ./install.sh 如果nagios-snmp插件装好后,就会在$NAGIOS/libexec目录下生成check_snmp_int.pl等
七:安装Pnp 首先将Pnp进行解压 198 tar -xzvf pnp-0.4.9.tar.gz 199 cd pnp-0.4.9 将Pnp进行配置,编译和安装 206 ./configure--with-rrdtool=/usr/local/rrdtool/bin/rrdtool--with-perfdata-spool-dir=/usr/local/nagios/share/perfdata/ 207 make all 208 make install 209 make install-config 将Nagios启动起来 211 /usr/local/nagios/bin/nagios -d/usr/local/nagios/etc/nagios.cfg 将Nagios添加到自动启动中 212 echo '/usr/local/nagios/bin/nagios -d/usr/local/nagios/etc/nagios.cfg'>>/etc/rc.d/rc.local 将$NAGIOS目录的所有者及所属目录的所有者设置为Nagios用户和Nagios组 215 chown -R nagios.nagios /usr/local/nagios 进入Pnp目录,将模板文件改名 218 cd /usr/local/nagios/etc/pnp/ 220 mv rra.cfg-sample rra.cfg 221 mv npcd.cfg-sample npcd.cfg 222 mv process_perfdata.cfg-sampleprocess_perfdata.cfg 223 cd pages/ 225 mv web_traffic.cfg-sample web_traffic.cfg 229 cd check_commands/ 231 mv check_nwstat.cfg-sample check_nwstat.cfg 再将process_perfdata.cfg文件中的log_level设置为2,以生成日志 vi /usr/local/nagios/etc/pnp/process_perfdata.cfg 再将Nagios重新启动 235 service nagios restart 将机器重新启动 246 reboot 查看是否有Rrd数据生成 257 ls /usr/local/nagios/share/perfdata/ 查看Apache的运行用户,将该用户加入到Nagios组中 262 grep ^User /usr/local/apache2/conf/httpd.conf 263 usermod -G nagios daemon 修改Apache配置文件,并且添加访问控制 265 vi /usr/local/apache2/conf/httpd.conf 访问控制的内容如下 #setting for nagios 20070707 ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin <Directory "/usr/local/nagios/sbin"> Options ExecCGI AllowOverride None Order allow,deny Allow from all AuthName"Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd Require valid-user </Directory>
Alias /nagios /usr/local/nagios/share <Directory "/usr/local/nagios/share"> Options None AllowOverride None Order allow,deny Allow from all AuthName"Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd Require valid-user </Directory> 再生成访问密码文件 267 /usr/local/apache2/bin/htpasswd -c/usr/local/nagios/etc/htpasswd test 修改Apache文件后,要将Apache重启才能生效 274 killall httpd 275 /usr/local/apache2/bin/apachectl -k start 再查看Nagios的Rrd文件生成目录 270 tail -f /usr/local/nagios/var/perfdata.log 再检查有没有Rrd数据生成 271 ls /usr/local/nagios/share/perfdata/ 这时应该可以看到有数据生成了。
本文出自 “gzmaster” 博客,请务必保留此出处http://gzmaster.blog.51cto.com/299556/79312