How to install memcached on CentOS

Posted by 6bytes at 13 March 2010

Category: CentOS, Linux

Tags: , , , ,

Before we install memcached we need a dependency library libevent. Check for latest stable version at http://monkey.org/~provos/libevent/

cd /usr/local/src
wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar -xzvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure --prefix=/usr/local
make
make install
cd ..

Now lets install memcached. Check for latest stable version at http://memcached.org/

wget http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz
tar -xzvf memcached-1.4.4.tar.gz
cd memcached-1.4.4
LDFLAGS='-Wl,--rpath /usr/local/lib' ./configure --prefix=/usr/local
make
make install

More information about LDFLAGS http://en.wikipedia.org/wiki/Linker

Run memcached as a daemon. Basic options: d = daemon, m = memory, u = user, l = IP to listen to, p = port

memcached -u root -d

or

memcached -u root -d -m 512 -l 127.0.0.1 -p 11211

To stop daemon type

pkill memcached

Now we’re off to installing php extension memcache.

4 Comments

  1. [...] installing memcached daemon we have to install memcache PHP [...]

    Reply
  2. [...] last two posts I described how to install memcached daemon and memcache extension for PHP. Today I’ll show you how to configure your PHP to use [...]

    Reply
  3. Jake Tors says

    “yum install memcached”, you do not need to compile from source! always try the package manager first, it will install all prerequisites.

    Reply
    • 6bytes says

      Correct, but I happened to have to install memcache on a server where it wasn’t in the allowed yum repository.

      Reply

Leave a Reply

Leave a Reply
  • (required)
  • (required) (will not be published)