在W3 Total Cache里面的教程复制的
Memcached (Daemon) Installation:
Time required: 2 minutes
1. Try to install with yum:# yum install libevent libevent-devel复制代码If this succeeds skip to #5. If this fails, then let's compile. Download and extract the latest stable version:# cd /usr/local/src && wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz && tar -xzf libevent-1.4.13-stable.tar.gz && cd libevent-1.4.13-stable复制代码2. Let's compile:# ./configure && make && make install复制代码3. In the output you should see:
Libraries have been installed in: /usr/local/lib
If so you can:# echo "/usr/local/lib/" > /etc/ld.so.conf.d/libevent.conf复制代码4. Configure your server for the new install:# ldconfig -v复制代码5. Now find the latest stable memcached, download and extract:# cd /usr/local/src && wget http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz && tar -xzf memcached-1.4.4.tar.gz && cd memcached-1.4.4复制代码6. Let's compile:# ./configure && make && make install复制代码7. Make sure memcached is starts automatically on server boot:# touch /etc/init.d/memcached
# echo '#!/bin/sh -e' >> /etc/init.d/memcached
# echo '/usr/local/bin/memcached -d -m 128 -p 11211 -u nobody -l localhost' >> /etc/init.d/memcached
# chmod u+x /etc/init.d/memcached
# echo '/etc/init.d/memcached' >> /etc/rc.local复制代码8. And finally, let's start memcached:# /etc/init.d/memcached复制代码