How to Install Memcached on Debian 9

memcached logo

In this tutorial we will show you how to install memcached service on debian 9. For you dont know what is memcached, memcached is a free opensource, high performance memory object caching system. Memcached service usually used for php application to cache object after query from SQL, memcached also use for other cache such as object cache for apache or nginx and other service that need high and performance cache.


This article assumes you have at least basic knowledge of linux, know how to use the shell, root user or non-root user account with sudo privileges set up on your server.

Step 1 – Update repositories list

First we need to update repository database using these command below

Step 2 – Install memcached and additional module

Install using apt-get like this command below

Step 3 – Configure memcached

The default file config path for Memcached is /etc/memcached.conf

Change the settings,for this example we will set memcached for 128MB used memory for caching.

Restart Memcached process to make changes.

To enable auto start memcached service after booting

Confirm the Memcached running status

Example output

Step 4 – Configure Firewall

To make sure the connection from client to our memcached server can be established we need to adding new rule to firewall
We will allow connection from port no 11211 using this following command.



Check the remote connectivity

Step 5 – Install PHP module

To make the php can use memcached , we need install php module for memcached

Update repo list

Install php module using apt-get

Restart apache and memcached service


Congratulations, you have successfully install memcached on debian 9. Thanks for using this tutorial for installing memcached on debian 9


You may also like...

Leave a Reply

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