May 04 2008
Installing cmemcache on Ubuntu
Here are my cookbook notes for setting up cmemcache, the python extension for libmemcache on Ubuntu. You’ll want to install this if you’re using the Django cache framework or need to use memcached for any other python needs.
The cookbook is mostly an abbreviation of the setup instructions for reviewboard.
Install Dependencies
sudo apt-get install build-essential python-dev memcached libmemcache-dev python-dev
Install cmemcache
Note, you might want to check for the latest version.
wget http://gijsbert.org/downloads/cmemcache/cmemcache-0.91.tar.bz2
tar -xvf cmemcache-0.91.tar.bz2
cd cmemcache-0.91
sudo python setup.py install
Running
Here are some instructions on running memcached. The following example runs memcached with 2G of memory listening on port 10.0.0.40 port 11211.
memcached -d -m 2048 -l 10.0.0.40 -p 11211
That’s it! If something went wrong or you’re a compile junkie you might want to install libmemcache from source, instead of using the apt-get.
Testing
After running you can test with the test.py file provided in the download.
python test.py
Install libmemcache from source
If you’re not on a debian distribution and can’t simply use the apt-get install libmemcache you can install from source w/ the following steps.
wget http://people.freebsd.org/~seanc/libmemcache/libmemcache-1.4.0.rc2.tar.bz2
tar -xvf libmemcache-1.4.0.rc2.tar.bz2
cd libmemcache-1.4.0.rc2
./configure
make
sudo make install