LNMP源码安装
安装epelrpm–ivh http://mirrors.neusoft.edu.cn/epel/6Server/x86_64/epel-release-6-8.noarch.rpmyum install mhash libmcrypt mcrypt make apr* autoconf automake curl curl-devel gccgcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patchperl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel pplcloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-develkrb5-devel zlib-devel libXpm* freetype freetype-devel libjpeg* libpng*php-common php-gd ncurses* libtool* libxml2 libxml2-devel patchwget http://nginx.org/download/nginx-1.5.4.tar.gzwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.tar.gzhttp://mirrors.scie.in/mariadb/mariadb-5.5.31/kvm-tarbake-jaunty-x86/mariadb-5.5.31.tar.gzhttp://www.php.net/get/php-5.4.16.tar.gz/from/a/mirrorwget http://jaist.dl.sourceforge.net/project/mysql.mirror/MySQL%205.6.12/mysql-5.6.12-source.tar.gzgroupadd mysqluseradd -g mysql mysql -s /sbin/nologinmkdir -p /data/mysqlchown -R mysql:mysql /data/mysqlmkdir -p /usr/local/mysql
cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql-DSYSCONFDIR=/etcmake && make install./scripts/mysql_install_db--user=mysql --basedir=/data/mysqlcp ./support-files/mysql.server/etc/rc.d/init.d/mysqldchmod 755 /etc/init.d/mysqldvi /etc/rc.d/init.d/mysqldbasedir = /usr/local/mysqldatadir = /data/mysql
chkconfig mysqld on
./scripts/mysql_install_db–basedir=/usr/local/mysql–datadir=/data/mysql--user=mysql
echo “PATH=$PATH:/usr/local/mysql/bin”>>/etc/profilesource /etc/profilechown -R root.mysql /usr/local/mysql/
ln -s /usr/local/mysql/lib/mysql/usr/lib/mysqlvi /etc/ld.so.conf.d/mysql.conf/usr/local/mysql/lib
/bin/mysqld_safe –user=mysql&mysqladmin -u root password vmware
http://wiki.nginx.org/InstallOptions./configure --user=www --group=www --with-http_stub_status_module--with-http_flv_module --with-http_ssl_module --with-pcre --with-file-aio--with-http_gzip_static_modulemake&& make installvi/etc/init.d/nginx#!/bin/bash##Startup script for Nginx - this script starts and stops the nginx daemon##chkconfig: - 85 15#description: Nginx is an HTTP(S) server,HTTP(S) reverse proxy and IMAP/POP3 proxy server#processname: nginx#config: /usr/local/nginx/conf/nginx.conf#pidfile: /usr/local/nginx/logs/nginx.pid
#Source function library../etc/rc.d/init.d/functions
#Source networking configuration../etc/sysconfig/network
#Check that networking is up.["$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"prog=$(basename$nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
[-f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
start(){[ -x $nginx ] || exit 5[ -f $NGINX_CONF_FILE ] || exit 6echo -n $"Starting $prog: "daemon $nginx -c $NGINX_CONF_FILEretval=$?echo[ $retval -eq 0 ] && touch$lockfilereturn $retval}
stop(){echo -n $"Stopping $prog: "killproc $prog -QUITretval=$?echo[ $retval -eq 0 ] && rm -f$lockfilereturn $retval}
restart(){configtest || return $?stopsleep 1start}
reload(){configtest || return $?echo -n $"Reloading $prog: "killproc $nginx -HUPRETVAL=$?echo}
force_reload(){restart}
configtest(){$nginx -t -c $NGINX_CONF_FILE}
rh_status(){status $prog}
rh_status_q(){rh_status >/dev/null 2>&1}
case"$1" instart)rh_status_q && exit 0$1;;stop)rh_status_q || exit 0$1;;restart|configtest)$1;;reload)rh_status_q || exit 7$1;;force-reload)force_reload;;status)rh_status;;condrestart|try-restart)rh_status_q || exit 0;;*)echo $"Usage: $0{start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"exit 2esac
wgethttp://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz安装mcrypttar -zxvf mcrypt-2.6.8.tar.gzcd mcrypt-2.6.8exportLD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATHLD_LIBRARY_PATH=/usr/local./configure
tar zxvf php-5./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config--with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib--enable-xml --enable-bcmath --enable-shmop --enable-sysvsem--enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm--enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl--enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap--without-pear --with-gettext --enable-session --with-mcrypt=/usr/local/include--with-curlmake && make install
cp php.ini-production /usr/local/php5/etc/php.ini#复制php配置文件到安装目录rm -rf /etc/php.ini #删除系统自带配置文件ln -s /usr/local/php5/etc/php.ini /etc/php.ini#添加软链接cp /usr/local/php5/etc/php-fpm.conf.default/usr/local/php5/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件vi /usr/local/php5/etc/php-fpm.conf#编辑user= www #设置php-fpm运行账号为wwwgroup= www #设置php-fpm运行组为wwwpid= run/php-fpm.pid #取消前面的分号设置 php-fpm开机启动cp /usr/local/src/php-5.4.5/sapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm#拷贝php-fpm到启动目录chmod +x /etc/rc.d/init.d/php-fpm#添加执行权限chkconfig php-fpm on #设置开机启动vi /usr/local/php5/etc/php.ini;date.timezone=修改为:date.timezone = Shanghai #时区expose_php =On
vi /usr/local/nginx/conf/nginx.confuser www www;index index.php index.html index.htm;#pass the PHP scripts to FastCGI server listeningon 127.0.0.1:9000#location ~ \.php$ {root html;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;include fastcgi_params;}#取消FastCGI server部分location的注释,并要注意fastcgi_param行的参数,改为$document_root$fastcgi_script_name,或者使用绝对路径include vhost/*.conf; #虚拟主机配置文件egserver{listen 80;server_name www.domain.com;root /usr/local/nginx/html/blog;index index.php index.html index.htm;# if (!-e $request_filename) {# rewrite ^.+/?(/blog/wp-.*) $1 last;# rewrite ^.+/?(/blog/.*\.php)$ $1 last;# rewrite ^(.+)$ /blog/index.php?q=$1 last;# }
# pass the PHP scripts to FastCGIserver listening on 127.0.0.1:9000#location ~ \.php$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}
location ~.*\.(gif|jpg|jpeg|png|bmp|swf)$ {expires 30d;}location ~ .*\.(js|css)?$ {expires 1h;}
#log_format access '$remote_addr - $remote_user [$time_local] "$request" '#'$status $body_bytes_sent"$http_referer" '#'"$http_user_agent"$http_x_forwarded_for';#access_log /var/logs/nginx/access.log access;}/etc/init.d/nginxrestart
<?phpphpinfo();?>
chown www.www /usr/local/nginx/html/ -Rchmod 700 /usr/local/nginx/html/ -R
xcache#/usr/local/php/bin/phpize#./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-configmake&& make installInstalling shared extensions: /usr/local/php5/lib/php/extensions/no-debug-non-zts-20100525/
rrdtoolhttp://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.8.tar.gzcactihttp://www.cacti.net/downloads/cacti-0.8.8a.tar.gzyum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetypefreetype-devel libart_lgpl-develtar zxvf rrdtool-1.4.8.tar.gz
cd rrd rrdtool-1.4.8
./configure –prefix=/usr/local/rrdtool && make && make install
yum install net-snmp-utils php-snmp net-snmp-libs
vim /etc/snmp/snmpd.conf
注释掉下面2行
#view systemview included .1.3.6.1.2.1.1
#view systemview included .1.3.6.1.2.1.25.1.1
增加如下一行
view systemview included .1
完整配置文件如下com2secnotConfigUser default public
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
view systemview included .1
access notConfigGroup “” any noauth exact systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat
chkconfig snmpd on
chkconfig snmptrapd ontar zxvf cacti-0.8.8a.tar.gz
mv cacti-0.8.8a/* /usr/local/nginx/html/cacti/*
useradd cacti -g users -s /sbin/nologin
mysql -p
mysql>create database cacti;
mysql>use cacti;
mysql>source /usr/local/nginx/html/cacti/cacti.sql
mysql>GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY ‘vmware’;
mysql> flush privileges;
mysql> \q
打开ip/cacti按操作提示安装,CACTI安装完使用,在RRD目录一直未能生成监控文件,导致Graph中不能生成监控图像。
执行/usr/local/php-5.4.16/bin/php/usr/local/nginx/html/cacti/poller.php提示找不到*.so文件,最后才发现是安装操作系统时php的rpm安装包没有卸载掉,导致执行的时候调用了/usr/bin/php,正确PHP Binary Path 应该是/usr/local/php-5.3.24/bin/php
在监控端执行命令检查是否可以抓取数据
snmpwalk -c public -v 2c 192.168.*.*
如果出现SNMP ERROR说明snmp配置错误或者防火墙端口没有开放
为什么要在我喜欢上你的时候将我抛弃。 有旳人,曾经是无话不说.现在却无话可说. 伤感个性签名:习惯一个人在那街角徘徊然后慢慢回忆你是如何远去。 爱是个动词。打开双腿,要先打开心门,而心门的钥匙,就是男人不安分的手。 生命中最美好的都是看不见的这就是为什么我们会在接吻哭泣许愿的时候闭上眼睛 我承认我的任性,但你敢承认你的绝情么?
页:
[1]