How To Install and Use Memcache on Ubuntu

Memcached  is a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source  must be read.

Install Memcached

1.     Firstly we install libevent

sudo apt-get update

sudo apt-get install libevent-core-2.0-5

2.  Install memcached

sudo apt-get install memcached


3.  configure iptables  with these entries

sudo iptables -A INPUT -m state –state NEW -m tcp -p tcp –dport 11211 -j ACCEPT

sudo iptables -A INPUT -m state –state NEW -m udp -p udp –dport 11211 -j ACCEPT

4.  Go to  /usr/share/memcached/memcached.conf.default
and  change defulat connection port:

-p 11211 [defualt]


-m 20

and ip address also
-l [ip address ]

5.  Now also configure    /etc/memcached.conf

change    port

-p 11211 [defualt]

and ip address

-l [ip address ]


-> telnet 11211

You can check memcached is runing or not.

Leave a Reply

Your email address will not be published. Required fields are marked *

− 1 = 8