首先准备软件包:
libevent-2.0.21-stable.tar.gz
libmcrypt-2.5.7.tar.gz
memadmin-1.0.12.tar.gz
memcache-2.2.7.tgz
memcached-1.4.15.tar.gz
nginx-1.2.7.tar.gz
php-5.4.11.tar.gz
下载链接
http://down.51cto.com/data/730444
参考
wget http://nginx.org/download/nginx-1.2.7.tar.gz |
1、安装gcc
[root@radius ~]# yum install gcc gcc-c++ autoconf automake
2、安装nginx
[root@radius nginx-1.2.7]# yum -y install pcre-devel zlib-devel openssl openssl-devel
[root@radius Package]# tar -zxvf nginx-1.2.7.tar.gz
[root@radius Package]# cd nginx-1.2.7
[root@radius nginx-1.2.7]# ./configure --prefix=/usr/local/nginx
[root@radius nginx-1.2.7]# make
[root@radius nginx-1.2.7]# make install
[root@radius ~]# vim /etc/init.d/nginx
#!/bin/sh # Source function library. # Source networking configuration. if [ -f /etc/sysconfig/nginx ];then # Check that networking is up. nginx="/usr/local/nginx/sbin/nginx" NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/subsys/nginx start() { stop() { restart() { reload() { force_reload() { configtest() { rh_status() { rh_status_q() { case "$1" in |
[root@radius ~]# chmod 755 /etc/init.d/nginx
[root@radius ~]# chkconfig --add nginx
[root@radius ~]# chkconfig nginx on
[root@radius ~]# service nginx start
测试:http://192.168.137.35/
[root@radius ~]# service nginx stop
3、安装PHP
[root@radius ~]# yum install libxml2-devel bzip2-devel curl-devel
[root@radius Package]# tar -zxvf libmcrypt-2.5.7.tar.gz
[root@radius libmcrypt-2.5.7]# ./configure
[root@radius libmcrypt-2.5.7]# make
[root@radius libmcrypt-2.5.7]# make install
[root@radius ~]# cd Package/
[root@radius Package]# tar -zxvf php-5.4.11.tar.gz
[root@radius Package]# cd php-5.4.11
[root@radius php-5.4.11]# ./configure --prefix=/usr/local/php --enable-fastcgi --enable-fpm --with-mcrypt --with-zlib --enable-mbstring --disable-pdo --with-curl --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-bz2 --with-xml --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-xslt --enable-memcache --enable-zip --with-pcre-regex --with-mysql
[root@radius php-5.4.11]# make
[root@radius php-5.4.11]# make install
[root@radius php-5.4.11]# cp php.ini-production /usr/local/php/lib/php.ini
[root@radius php-5.4.11]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
[root@radius php-5.4.11]# cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
[root@radius php-5.4.11]# chmod 755 /etc/rc.d/init.d/php-fpm
[root@radius php-5.4.11]# chkconfig --add php-fpm
[root@radius php-5.4.11]# chkconfig php-fpm on
4、整合nginx和php-fpm
[root@radius ~]# mkdir /web
[root@radius ~]# cd /web
[root@radius web]# mkdir htdocs
[root@radius ~]# vim /usr/local/nginx/conf/nginx.conf
修改server区段
... |
测试
[root@radius ~]# vim /web/htdocs/index.php
<?php |
[root@radius ~]# service nginx start
[root@radius ~]# service php-fpm start
http://192.168.137.35/
[root@radius ~]# service nginx stop
[root@radius ~]# service php-fpm stop
5、安装PHP memcach
[root@radius ~]# cd Package/
[root@radius Package]# tar -zxf memcache-2.2.7.tgz
[root@radius Package]# cd memcache-2.2.7
[root@radius memcache-2.2.7]# /usr/local/php/bin/phpize
[root@radius memcache-2.2.7]# ./configure --with-php-config=/usr/local/php/bin/php-config --enable-memcache
[root@radius memcache-2.2.7]# make
[root@radius memcache-2.2.7]# make install
出现如下提示:
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
在[root@radius ~]# vim /usr/local/php/lib/php.ini大约868行左右添加如下一行来载入memcache扩展
6、安装memcached
[root@radius Package]# tar -xf libevent-2.0.21-stable.tar.gz
[root@radius Package]# cd libevent-2.0.21-stable
[root@radius libevent-2.0.21-stable]# ./configure --prefix=/usr/local/libevent-2.0.21
[root@radius libevent-2.0.21-stable]# make
[root@radius libevent-2.0.21-stable]# make install
[root@radius ~]# cd Package/
[root@radius Package]# tar -zxf memcached-1.4.15.tar.gz
[root@radius Package]# cd memcached-1.4.15
[root@radius memcached-1.4.15]# ./configure --prefix=/usr/local/memcached-1.4.15 --with-libevent=/usr/local/libevent-2.0.21
[root@radius memcached-1.4.15]# make
[root@radius memcached-1.4.15]# make install
为memcached建立启动脚本
[root@radius ~]# vim /etc/init.d/memcached
#!/bin/bash |
建立memcached参数配置文件:
[root@radius ~]# echo -e 'PORT="11211" \nUSER="root" \nMAXCONN="1024" \nCACHESIZE="64" \nOPTIONS="" ' > /etc/sysconfig/memcached
添加执行权限,加入到系统服务:
[root@radius ~]# chmod 755 /etc/init.d/memcached
[root@radius ~]# chkconfig --add memcached
[root@radius ~]# chkconfig memcached on
安装memadmin可视化管理界面:
[root@radius Package]# tar -zxf memadmin-1.0.12.tar.gz
[root@radius Package]# cd memadmin
[root@radius memadmin]# mkdir /web/htdocs/memadmin
[root@radius memadmin]# mv * /web/htdocs/memadmin/
测试
[root@radius memadmin]# service memcached start
[root@radius memadmin]# service php-fpm start
[root@radius memadmin]# service nginx start
http://192.168.137.35/memadmin
用户名:admin
密码:admin
参考链接:
http://tangs90.net/linux-nginx-memcache/ http://tech.idv2.com/2008/07/10/memcached-001/ http://blog.csdn.net/ajun_studio/article/details/6745791 http://blog.csdn.net/ajun_studio/article/details/6746877 http://tec110505.diandian.com/post/2012-12-26/40047899151 http://www.51testing.com/?uid-116228-action-spacelist-type-blog-itemtypeid-10023 http://www.networkquestions.org/archives/1662 http://www.sunchis.com/html/db/memcached/2011/0526/333.html http://junier.iteye.com/blog/1816461 |
——————————————————————————————————————————————————
第一次做没有成功的笔记
2、安装libevent
[root@radius libevent-2.0.19-stable]# ./configure --prefix=/usr/local/libevent
[root@radius libevent-2.0.19-stable]# make && make install
3、安装memcached
[root@radius ~]# tar -zxvf memcached-1.4.13.tar.gz
[root@radius ~]# cd memcached-1.4.13
[root@radius memcached-1.4.13]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
[root@radius memcached-1.4.13]# make && make install
4、安装apache
[root@radius httpd-2.2.15]# ./configure --prefix=/usr/local/apache --enable-so --enable-dav --enable-dav-fs --enable-maintainer-mode --enable-rewrite=shared