Installing memcached from source on Ubuntu 8.10

In my previous post I wrote that installing memcached went fairly smoothly. I chose to install directly from source rather than from a package repository to make sure I had the most recent version available, because Ubuntu 8.10 ships with version 1.2.2 of memcached, whereas 1.2.6 is the latest. These are the steps that I took.

In case you are starting off from a clean install, like me, you might need to install the C/C++ compiler and Make in order to get going:

sudo apt-get install g++ make

Installing libevent
memcached is dependent on libevent, which is an event notification library, so we should install it first:

wget http://www.monkey.org/~provos/libevent-1.4.9-stable.tar.gz
tar xvfz libevent-1.4.9-stable.tar.gz
cd libevent-1.4.9-stable/
./configure && make
sudo make install

By default, libevent gets installed into /usr/local/lib/, which may or may not be a known library path for the dynamic linker in your system. To make sure, add it in like this:

sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/libevent.conf'
sudo ldconfig -v

The verbose option -v to ldconfig is just there so you can watch the output and conclude that ldconfig sees /usr/local/lib/ and the libevent files.

Installing memcached
Installing memcached is very similar to the above steps:

wget http://danga.com/memcached/dist/memcached-1.2.6.tar.gz
tar xvfz memcached-1.2.6.tar.gz
cd memcached-1.2.6/
./configure && make
sudo make install

By default, memcached gets installed into /usr/local/bin/, and to test run it you can do:

/usr/local/bin/memcached -vv

Again, the double verbose option is there just so you can see that something is happening. For actual production use, you will want to use other options too, for example -d for daemon mode and -m for adjusting the memory limit.

Advertisements

6 responses to “Installing memcached from source on Ubuntu 8.10

  1. Thanks for the post, I installed memcached following the steps from your blog post, except I installed version 1.2.7 of memcached, when I start memcached, I got the error:

    [err] event_queue_remove: 0x60d300(fd -1) not on queue 1

    Have you met the problem before, any suggestions to solve that? I am using ubuntu8.10 64bit system, thanks!

  2. devdoodles

    I just tried installing memcached 1.2.7 myself following the exact steps I listed in my post above, except using memcached-1.2.7.tar.gz instead of 1.2.6 (obviously). It seems to work fine: memcached starts up and I was able to simulate some load on it through get()/set() calls without any errors. I also run Ubuntu 8.10, albeit not the 64bit version.

    Are you sure you downloaded and compiled libevent as described above? The error message as well as this post suggests that might be the problem:

    http://groups.google.com/group/memcached/browse_thread/thread/a57944eaa6730753

  3. Thanks devdoodles, I removed the default libevent installed from repository, and re-installed libevent and memcached manually, this time it works fine, thank you 🙂

  4. Thanks for the post! The ldconfig part was the missing link for me 🙂

    Saved me a ton of hassle!

  5. devdoodles

    Nice to hear! I tend to forget ldconfig myself every now and then. 😉

  6. Pingback: Install memcached in ubuntu « sudo gem*