How to Install Memcache on Debian 10

How to Install Memcache on Debian 10

Memcached is a high-performance free, open source, in-memory key-value data store. Usually used to speed up applications by caching various objects from the results of API calls and databases.

This article shows how to install and configure Memcache on Debian 10.


You must be logged in as a user with sudo access to be able to install packages on your Debian system.
Installing Memcache on Debian 10

The memcache package is included in the default Ubuntu 20.04 repositories. To install it, enter the following command as root or user with sudo privileges:

sudo apt update
sudo apt install memcached libmemcached-tools

The libmemcached tools package provides several command line tools for interacting with the Memcached server.

After the installation is complete, the Memcached service will start automatically. You can verify it by checking the service status:

sudo systemctl status memcached

The output will look like this:

Output :

memcached.service - memcached daemon
   Loaded: loaded (/lib/systemd/system/memcached.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-08-14 14:22:01 CDT; 3min 40s ago
     Docs: man:memcached(1)

There she is. You have successfully installed Memcache on your Debian 10 server.

Configuring Memcache

Memcached options can be configured in the /etc/memcached.conf file. The default configuration settings are sufficient for most users.

Remote Access

The memcached service listens on localhost only. If the clients connected to the server are also running on the same host, you don’t need to change the default configuration file.

If not configured properly, Memcache can be used to perform distributed denial of service (DDoS) attacks. To allow remote connections to the Memcached server you will need to configure your firewall and allow access to Memcached UDP port 11211 from trusted clients only.

The following example assumes that you are connected to the Memcached server over a private network. Server IP, and client IP address

The first step is to edit the memcache configuration and set the service to listen on the server’s private network interface:

To do this, open the memcached.conf configuration file:

sudo nano /etc/memcached.conf

Find the line starting with -l and replace with the server IP address



Restart the Memcached service for the changes to take effect:

sudo systemctl restart memcached

Once the service is configured the next step is to open the memcache port on the firewall.

sudo ufw allow from to any port 11211

You can now connect to the Memcached server from a remote location.

Connecting to Memcached

There are many memcache client implementations written for different programming languages.

To use Memcached as a caching database for your PHP applications such as WordPress, Drupal or, Magento, you need to install the php-memcached extension:

sudo apt install php-memcached


There are several Python libraries for interacting with memcache. You can install the library of your choice using pip:

pip install 
pip install python-memcached


We’ve shown you how to install Memcached on Debian 10. For more information on this topic, see the Memcached Wiki.

If you have any questions or feedback feel free to comment below.

Related posts

How to Install PHP on Ubuntu 20.04


How to Install Apache on Ubuntu 20.04


Using the ‘ldd’ command on Linux


How to Install Memcached on Ubuntu 20.04 LTS


Fedora 31: How to Install Fuel CMS with Nginx


How to Install Steam on Ubuntu 20.04


How to Install Atom Text Editor on Ubuntu 20.04


How to Configure a Static IP Address on Ubuntu 20.04


How to Install Ruby on Rails (RoR) on Debian 10