This is a step by step guide to installing memcached from source on CentOS. To install using yum instead, run yum install memcached. The version of CentOS that I am using is CentOS release 5.2 (Final); to find what version you are using:
cat /etc/redhat-release
First, install the dependency libevent:
cd /usr/local/src curl -O http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz tar xzvf libevent-1.4.14b-stable.tar.gz cd libevent-1.4.14b-stable ./configure --prefix=/usr/local make && make install
Next, install memcached:
cd /usr/local/src curl -O http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz tar xzvf memcached-1.4.5.tar.gz cd memcached-1.4.5 LDFLAGS='-Wl,--rpath /usr/local/lib' ./configure --prefix=/usr/local make && make install
Verify that memcached starts:
memcached -u root -d
If there were no errors, make sure it is running:
ps aux | grep memcached
And finally, to stop memcached:
pkill memcached
These instructions prevent the following errors:
memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory configure: error: libevent is required If it's already installed, specify its path using --with-libevent=/dir/