Sunday, August 5, 2012

How to Compile and Install the Latest Memcached from Source on Linux

Compiling Memcached directly from source allows you to take advantage of the latest concurrency fixes, memory management optimizations, and binary protocol improvements that may not yet be available in standard distribution package repositories.

Prerequisites: libevent and build development tools.

1. Install Dependencies

Memcached depends on the libevent event notification library:

# On CentOS / RHEL:
yum install libevent-devel gcc make -y

# On Debian / Ubuntu:
apt-get install libevent-dev build-essential -y

2. Download and Build Memcached

Fetch the latest release tarball and compile:

cd /usr/src
wget http://memcached.org/latest -O memcached-latest.tar.gz
tar -zxf memcached-latest.tar.gz
cd memcached-*
./configure --prefix=/usr --sysconfdir=/etc
make
make test
make install

3. Starting the Daemon

Launch Memcached as a non-privileged user (e.g. nobody) with 64MB memory limit listening on localhost:

memcached -d -u nobody -m 64 -p 11211 -l 127.0.0.1

Confirm the service is actively listening:

netstat -tulpn | grep 11211

No comments:

Post a Comment

How Google Antigravity Solved the Mysterious NVIDIA Sleep Reboot on My Dell Inspiron 7567 (Ubuntu Linux)

If you run modern Ubuntu or Linux on a Dell Inspiron 15 Gaming (7567) or a similar 7th-gen Intel laptop paired with an NVIDIA GeForce GTX ...