搭建Cacti监控系统(一)-- 搭建LNMP 环境
【实验环境】系统版本:Rhel6.3_x64
平台:LNMP
IP:192.168.30.100
相关软件包:
cacti-0.8.8a.tar.gz
rrdtool-1.4.7.tar.gz
cacti-spine-0.8.8a.tar.gz
nginx-1.2.6.tar.gz
mysql-5.5.29.tar.gz
安装lnmp环境
1.1安装基本软件包
# yum -y install vim gcc gcc-c++ make openssl openssl-devel gdgd-devel pcre-devel
1.2 下载编译安装Mysql
# yum -y install cmake perl bison ncurses-devel
在系统中添加 mysql 的用户# useradd -s /sbin/nologin -M mysql 解压缩mysql # tar -zxvf mysql-5.5.29.tar.gz# cd mysql-5.5.29# Mysql5.5.x 的版本采用新的 cmake 的方式进行编译 , 可以通过以下方式查看 cmake 的配置选项 : (可选)# cmake . -L # overview # cmake . -LH # overview with help text # cmake . -LAH # all params with help text # ccmake . # interactive display 源码安装配置:# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DINSTALL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=complex -DMYSQL_USER=mysql
配置完成后,注意检查输出有没有 CMake Error 的关键字,如果有,表示配置过程出错 , 需要解决问题后重新配置。如无,则进行下一步。
安装# make# make install Mysql 安装之后的配置:# cd /usr/local/mysql# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql # chown -R root .# cp support-files/my-medium.cnf/etc/my.cnf# vim /etc/my.cnfport = 3306socket = /tmp/mysql.sockbasedir = /usr/local/mysqldatadir = /data/mysqluser = mysqlcharacter_set_server = utf8 # cp support-files/mysql.server /etc/init.d/mysql # vim /etc/init.d/mysqlbasedir=/usr/local/mysqldatadir=/data/mysql 启动mysql# service mysql startStarting MySQL... SUCCESS! 查看mysql是否启动# netstat -nultp |grep mysqltcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 12569/mysqld
1.3 下载编译安装Nginx
# groupadd -r nginx
# useradd -s /sbin/nologin -M nginx
# yum –y install pcre-devel openssl-devel perl-ExtUtils-Embed
# tar -zxvf nginx-1.2.6.tar.gz -C /usr/src/
# cd /usr/src/
# ./configure \--prefix=/usr/local/nginx \--user=nginx \--group=nginx \--with-http_ssl_module \--with-http_gzip_static_module\--without-http_uwsgi_module \--without-http_scgi_module \--without-http_upstream_ip_hash_module \--with-http_perl_module --with-pcre
编译安装# make# make install
启动nginx# cd /usr/local/nginx/# sbin/nginx 为实验方便,关闭iptables# service iptables stopiptables: Flushing firewall rules: iptables: Setting chains to policy ACCEPT: filter iptables: Unloading modules: # chkconfig iptables off 测试nginx
1.4 下载编译安装PHP
# yum –y install libxml2-devel bzip2-devel libcurl-devel libjpeg libjpeg-devel libpng libpng-devel readline-devel net-snmp-devel# useradd -s /sbin/nologin -M fpmuser # tar zxvf php-5.4.12.tar.gz# cd php-5.4.12# ./configure \--prefix=/usr/local/php \--enable-fpm \--with-fpm-user=fpmuser--with-fpm-group=fpmuser \--disable-ipv6 --with-openssl \--with-zlib--with-bz2--with-curl \--enable-dba=shared--with-pcre-dir \--with-gd--with-jpeg-dir \--with-png-dir--with-zlib-dir \--with-mhash --enable-mbstring \--with-mysql=/usr/local/mysql/ \--with-mysql-sock=/tmp/mysql.sock \--with-mysqli=/usr/local/mysql/bin/mysql_config \--with-readline --with-snmp \--enable-sockets --enable-zip # make# make install 启动配置# cp php.ini-production /usr/local/php/lib/php.ini# cd /usr/local/php/etc/# cp -a php-fpm.conf.default php-fpm.conf# cd ..# sbin/php-fpm查看php是否启动#netstat -nultp |grep fpmtcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 6821/php-fpm 配置 nginx 支持 php :# vim /usr/local/nginx/conf/nginx.conf 启动如下选项indexindex.php index.html index.htm;location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_indexindex.php; fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name; include fastcgi_params; } # /usr/local/nginx/sbin/nginx -s reload测试# cd /usr/local/nginx/html# vim test.php<?php phpinfo();?>
至此LNMP 环境搭建完成
启动服务
/usr/local/mysql/bin/mysqld_safe &
/usr/local/php/sbin/php-fpm
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
下雨了,别忘了打伞,湿身是小,淋病就麻烦啦*^_^* 生,容易。活,容易。生活,不容易。 恐龙说:“遇到色狼,不慌不忙;遇到禽兽,慢慢享受……” 看尽天下A片,心中自然无码~ 不知该说些什么。。。。。。就是谢谢 如果有一双眼睛陪我一同哭泣,就值得我为生命受苦。
页:
[1]