How to install Memcached on Debian 10?
Last updated
Last updated
Memcached is a free and open-source application. It is used to speed up dynamic web applications by reducing the database load.
This tutorial demonstrates how to set up Memcached on Debian 10.
There are certain prerequisites that need to be met before you begin.
A server running Ubuntu 22.04
Non-root sudo user privileges
Step 1 - Memcached installation for Debian 10
The Ubuntu 20.04 repositories contain the memcached package. Enter the following command as root or user with sudo access to install it:
The libmemcached-tools package contains many command-line tools for communicating with the Memcached server.
The Memcached service will launch automatically after the installation is finished. You can confirm it by examining the service's state:
Congratulations! Memcached is successfully installed on your Debian 10 server.
Step 2 - Setting up Memcached
The /etc/memcached.conf file allows for the configuration of Memcached options. For the majority of users, the default configuration options are adequate.
Step 3 - Remote Access
Memcached can be used to launch a distributed denial-of-service (DDoS) attack if it is improperly configured. You must set up your firewall such that only trustworthy clients are permitted access to the Memcached UDP port 11211 in order to allow remote connections to the Memcached server.
It is assumed in the example below that you are connected via a private network to the Memcached server.
Edit the memcached configuration first, then configure the service to listen on the server's private networking interface. This can be done by opening the memcached.conf settings file:
Find the line that starts with -l 127.0.0.1, and substitute 192.168.100.20 for 127.0.0.1 in that line.
To make the modifications effective, restart the Memcached service:
The memcached port must be opened in the firewall after the service has been configured.
You can now establish a connection to the Memcached server from a remote location.
Step 4 - Getting Connected to Memcached
Memcached clients are available in a variety of versions and in numerous programming languages.
For working with memcache, there are numerous Python libraries. With pip, you can install the library of your choice:
We have successfully demonstrated how to set up Memcached on Debian 10.