Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Memcached on Debian 10 - DesignLinux

designlinux 0 Comments

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

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

Prerequisites #

You’ll need to be logged in as a user with sudo access to be able to install packages on your Debian system.

Installing Memcached on Debian 10 #

The memcached 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 updatesudo apt install memcached libmemcached-tools

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

Once the installation is completed, the Memcached service will start automatically. You can verify it by checking the status of the service:

sudo systemctl status memcached

The output will look like this:

● 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)
...

That’s it. You have successfully installed Memcached on your Debian 10 server.

Configuring Memcached #

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

Remote Access #

Memcached service listens on localhost only. If the client connecting to the server is also running on the same host you don’t need to change the default configuration file.

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

The following example assumes that you are connecting to the Memcached server over a private network. The server IP is 192.168.100.20, and the client’s IP address is 192.168.100.30

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

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

sudo nano /etc/memcached.conf

Locate the line that begins with -l 127.0.0.1 and replace 127.0.0.1 with the server IP address 192.168.100.20.

/etc/memcached.conf
-l 192.168.100.20

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 memcached port in the firewall .

sudo ufw allow from 192.168.100.30 to any port 11211

Now you can connect to the Memcached server from the remote location.

Connecting to Memcached #

There are many implementations of memcached clients written for different programming languages.

PHP #

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

sudo apt install php-memcached

Python #

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

pip install pymemcache
pip install python-memcached

Conclusion #

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

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

debian memcached

Related

Tags: debian, memcached

Pstree Command in Linux

Prev Post

Umask Command in Linux

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 1,017
  • 609,465

DesignLinux.com © All rights reserved

Go to mobile version