企业级LAMMP架构应用实践

一、LAMMP介绍:

LAMMP

四、安装和配置过程:

由于是实验,整个过程均在一台机器上实现,而简单的实现中蕴含这上述的架构。

服务器IP地址为:172.16.2.1

l编译安装apache:

1、解压下载的软件包[root@stu2 ~]# tar xf apr-1.4.6.tar.bz2[root@stu2 ~]# tar xf apr-util-1.5.2.tar.bz2[root@stu2 ~]# tar xf httpd-2.4.6.tar.bz22、安装开发库,和依赖性包[root@stu2 ~]# yum -y groupinstall “Development tools” “Server Platform Development”[root@stu2 ~]# yum -y install pcre-devel #安装依赖性包3、编译安装apr软件[root@stu2 ~]# cd apr-1.4.6[root@stu2 apr-1.4.6]# ./configure –prefix=/usr/local/apr[root@stu2 apr-1.4.6]# make && make install4、编译安装apr-util软件包[root@stu2 ~]# cd apr-util-1.5.2[root@stu2 apr-util-1.5.2]# ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr[root@stu2 apr-util-1.5.2]# make && make install5、编译安装httpd的软件包[root@stu2 ~] # cd httpd-2.4.6[root@stu2 httpd-2.4.6]# ./configure –prefix=/usr/local/apache –enable-so –enable-ssl –enable-cgi –enable-rewrite –with-zlib –with-pcre –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util –enable-modules=most –enable-mpms-shared=all –with-mpm=event[root@stu2 httpd-2.4.6] # make && make install[root@stu2 httpd-2.4.6]# cp build/rpm/httpd.init /etc/rc.d/init.d/httpd #复制源码包里面提供的httpd的SystemV脚本[root@stu2 httpd-2.4.6]# vim /etc/rc.d/init.d/httpd6、需要改动httpd的SystemV脚本的一些内容prog=httpdhttpd=${HTTPD-/usr/local/apache/bin/httpd}pidfile=${PIDFILE-/usr/local/apache/logs/${prog}.pid}lockfile=${LOCKFILE-/var/lock/subsys/${prog}}RETVAL=0# check for 1.3 configurationcheck13 () {CONFFILE=/usr/local/apache/conf/httpd.conf[root@stu2 httpd-2.4.6]# vim /usr/local/apache/conf/httpd.confServerName 172.16.2.1:80 #在配置文件中找到ServerName改成服务器的IP:端口#这样启动的时候就不会报错[root@stu2 httpd-2.4.6]# service httpd start #启动服务7、使系统能识别源码包安装的软件[root@stu2 httpd-2.4.6]# echo “PATH=/usr/local/apache/bin/:$PATH” >/etc/profile.d/httpd.sh[root@stu2 httpd-2.4.6]# source /etc/profile.d/httpd.sh[root@stu2 httpd-2.4.6]# ln -sv /usr/local/apache/include/ /usr/include/httpd[root@stu2 httpd-2.4.6]# chkconfig –add httpd #把服务加到开机自动启动的列表[root@stu2 httpd-2.4.6]# chkconfig –level 35 httpd on

l编译安装php、php-fpm、xcache、memcache:

1、解压下载的源码包[root@stu2 ~]#tar xf php-5.4.19.tar.bz2[root@stu2 ~]#tar xf memcache-2.2.7.tgz[root@stu2 ~]#tar xf xcache-3.0.3.tar.bz22、安装开发包和安装依赖性包[root@stu2 ~] #yum groupinstall “Server Platform Development” “Development tools” -y[root@stu2 ~]#yum install libxml2-devel bzip2-devel libmcrypt-devel libmcrypt-devel -y[root@stu2 ~]# cd php-5.4.19编译参数–enable-fpm,支持FastCGI PHP模块,此参数决定是否能把PHP安装成#FastCGI服务器[root@stu2 php-5.4.19]#./configure –prefix=/usr/local/php –enable-fpm –with-openssl –enable-mbstring –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –enable-sockets –with-mcrypt –with-bz2 –with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d –with-mysql=mysqlnd –with-pdo-mysql=mysqlnd –with-mysqli=mysqlnd

出现如上图所示就可以接续编译安装了。

[root@stu2 php-5.4.19]# make && make install3、建立php的配置文件,此配置文件在php的解压包中[root@stu2 php-5.4.19]# cp php.ini-production /etc/php.ini[root@stu2 php-5.4.19]# cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm4、使系统能够识别源码包安装的软件[root@stu2 php-5.4.19]#echo “PATH=/usr/local/php/bin:/usr/local/php/sbin:$PATH” > /etc/profile.d/php-fpm.sh[root@stu2 php-5.4.19]# source /etc/profile.d/php-fpm.sh[root@stu2 php-5.4.19]#cd /usr/local/php/etc5、建立php-fpm服务的配置文件,此配置文件的路径 /usr/local/php/etc[root@stu2 etc]# cp php-fpm.conf.default php-fpm.conf修改php-fpm服务配置文件的监听的IP地址改为本地IP地址[root@stu2 etc]#vim /usr/local/php/etc/php-fpm.confListen 172.16.2.1:90006、把服务脚本加执行权限,开启服务,把服务加到开机自启动列表中[root@stu2 etc]# chmod +x /etc/rc.d/init.d/php-fpm[root@stu2 etc]# service php-fpm start[root@stu2 etc]# chkconfig –add php-fpm[root@stu2 etc]# chkconfig –level 35 php-fpm on7、安装FastCGI与memcached服务连接的接口的一个软件[root@stu2 ~]# cd memcache-2.2.7[root@stu2 memcache-2.2.7]# yum install autoconf -y[root@stu2 memcache-2.2.7]# /usr/local/php/bin/phpize[root@stu2 memcache-2.2.7]# ./configure –with-php-config=/usr/local/php/bin/php-config –enable-memcache[root@stu2 memcache-2.2.7]# make && make install8、在php的配置文件里面装载memcache.so的模块路径[root@stu2 memcache-2.2.7]#vim /etc/php.iniextension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/memcache.so9、安装FastCGI加速opcode代码的软件[root@stu2 ~]# cd xcache-3.0.3[root@stu2 xcache-3.0.3]# /usr/local/php/bin/phpize[root@stu2 xcache-3.0.3]# ./configure –enable-xcache –with-php-config=/usr/local/php/bin/php-config[root@stu2 xcache-3.0.3]# make && make install10、建立xcache的配置文件,在xcache的解压的源码包里面[root@stu2 xcache-3.0.3]# vim /etc/php.ini 添加:extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/xcache.so[root@stu2 xcache-3.0.3]# service php-fpm restart #重启php-fpm服务

l安装Memcached服务:

如你想要拥有完美无暇的友谊,可能一辈子找不到朋友

企业级LAMMP架构应用实践

相关文章:

你感兴趣的文章:

标签云: