Showing posts with label centos. Show all posts
Showing posts with label centos. Show all posts

Monday, August 31, 2009

installing memcached on CentOS

How to install memcached on CentOS

This is a step by step guide to installing memcached from source on CentOS. 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.9-stable.tar.gz
tar xzvf libevent-1.4.9-stable.tar.gz
cd libevent-1.4.9-stable
./configure --prefix=/usr/local
make
make install

Next, install memcached:

cd /usr/local/src
curl -O http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz
tar xzvf memcached-1.2.6.tar.gz
cd memcached-1.2.6
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/