[root@localhost src]# yum -y install zlib-devel
#安装底层依赖包zlib-devel
[root@localhost src]# cd /usr/local/src/memcache-3.0.8
#进入memcache-3.0.8解压缩目录
[root@localhost memcache-3.0.8]# /usr/local/php/bin/phpize
#用phpize加载memcache模块。这条命令一定要进入memcache目录才能正确执行
[root@localhost memcache-3.0.8]# ./configure --with-php-config=/usr/local/php/bin/php-config
#编译前配置。指定php-config文件的位置
[root@localhost memcache-3.0.8]# make
#编译
[root@localhost memcache-3.0.8]# make install
#编译安装
[root@localhost memcached-1.4.17]# yum -y install libevent-devel
#安装memcache,需要先安装libevent-devel包,yum安装它
#注意libevent-devel包在CentOS 6.x的第二张光盘中
[root@localhost memcached-1.4.17]# ./configure --prefix=/usr/local/memcache
#编译前配置
[root@localhost memcached-1.4.17]# make
#编译
[root@localhost memcached-1.4.17]# make install
#编译安装
[root@localhost memcached-1.4.17]# useradd memcache
#添加memcache用户,这个用户只是用来启动服务的,不用设置密码
[root@localhost memcached-1.4.17]#/usr/local/memcache/bin/memcached-u memcache &
#在后台启动memcache服务器
[root@localhost memcached-1.4.17]# netstat -tlun | grep 11211
tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN
tcp 0 0::11211 ::* LISTEN
udp 0 0 0.0.0.0:11211 0.0.0.0:*
udp 0 0::11211 ::*
#memcache的端口是11211,已经启动了
[root@localhost memcached-1.4.17]# vi /etc/rc.local
#修改自启动文件
touch /var/lock/subsys/local
/usr/local/apache2/bin/apachectl start
/usr/local/mysql/bin/mysqld_safe --user=mysql &
/usr/local/memcache/bin/memcached -u memcache &
#加入memcache启动命令
新闻热点
疑难解答