Linux Administrator

How to Install Memcached From Source on Linux

In this article I will show how you can install Memcached from source on Linux system including the libevent library. There is only one prerequisite for memcached is libevent so first of all you have to install it.

Install Libevent

If there is no libevent is installed on your system you can install it following below command. If it is already installed on your system it might be very old version. In this case first of all you have to remove the libevent old version (libevent 1) using below command.

# aptitude purge libevent1 

If you have a recent version packaged by your linux distribution you should keep it and move on the next step to install directly memcached.

Now download and install the latest version of libevent check here  for latest version and change if needed the version bellow.

# cd /usr/local/src
# wget
# cd libevent-1.3e
# ./configure
# make
# make install 

By default this libraries will install under /usr/local/lib/. If you want it in another place you can do that by passing to configure a different prefix.

Install Memcached

Once libevent installed on your system properly now install the latest memcached version. Download the latest stable version from here and follow the below command to install.

# cd /usr/local/src
# wget
# tar zxvf memcached-1.2.4.tar.gz
# cd memcached-1.2.4
# ./configure
# make
# make install

By default memcached binary will be also install under /usr/local/bin/ you can start the memcached daemon using below command

# /etc/init.d/memcached

Basic Memcached Options

Follow the below basic memcached options:

memcached -d [-m memory_in_megabytes [-l listen_ip_address [-p listen_port]]]


# memcached -d -m 512 nobody -p 11211 -l

In above example will used to run a memcached daemon bind on on the default port 11211 using max 512MB memory.

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment