Debian/Ubuntu: apt-get install libevent-devRedhat/Centos: yum install libevent-develb) 下載解壓並安裝
wget https://memcached.org/latest[you might need to rename the file]tar -zxf memcached-1.x.x.tar.gzcd memcached-1.x.x./configure --prefix=/usr/local/memcachedmake && make test && sudo make install
ln -s /usr/local/memcached/bin/memcached /usr/bin/memcached
/bin/cp scripts/memcached.sysv /etc/init.d/memcached
sed -i 's@^USER=.*@USER=root@' /etc/init.d/memcached
sed -i 's@chown@#chown@' /etc/init.d/memcached
sed -i 's@/var/run/memcached/memcached.pid@/var/run/memcached.pid@' /etc/init.d/memcached
sed -i 's@^prog=.*@prog="/usr/local/memcached/bin/memcached"@' /etc/init.d/memcached #前面有軟連接,這裏能夠省略
chmod +x /etc/init.d/memcached
chkconfig --add memcached
chkconfig memcached on
cd ..
2) 自動安裝
For Debian or Ubuntu: apt-get install memcached
For Redhat/Fedora: yum install memcached緩存
若是你但願以socket方式來訪問memcached,那麼在啓動的時候就必須去掉 -l和-p參數,並加上-s參數:服務器