YouTube Icon

Code Playground.

How to Install Memcached on Ubuntu 20.04


How to Install Memcached on Ubuntu 20.04

Memcached is a free and open-source superior in-memory key-esteem information store. It is commonly used to accelerate applications by storing different items from the aftereffects of API and information base calls. 

This article tells the best way to introduce and design Memcached on Ubuntu 20.04. 

Installing Memcached

The memcached bundle is remembered for the default Ubuntu 20.04 archives. To introduce it, enter the accompanying order as root or client with sudo benefits : 

sudo apt update
sudo apt install memcached libmemcached-tools

The libmemcached-instruments bundle gives order line utilities that you can use to deal with the memcached worker. 

When the establishment is finished, the memcached administration will begin consequently. To check the status of the administration, enter: 

sudo systemctl status memcached

The yield will look something like this: ?

 memcached.service - memcached daemon
     Loaded: loaded (/lib/systemd/system/memcached.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2020-07-13 19:32:01 UTC; 23s ago

That is it, you have introduced memcached on your Ubuntu 20.04 worker, and you can begin utilizing it. 

Configuring Memcached

Memcached choices can be designed in the/and so on/memcached.conf record. Naturally, memcached is set to listen just on localhost. 

The default setup settings are adequate for most clients. 

Remote Access

On the off chance that the customer associating with memcached is running on a similar host, you ought not permit distant access. 

When inappropriately designed, memcached can be utilized to play out a dispersed refusal of-administration (DDoS) assault. To permit distant admittance to the memcached worker, you have to arrange the firewall and open the memcached UDP port 11211 just from confided in customers. 

The accompanying model accept that you need to interface with the memcached worker over a private organization. The memcached worker IP is, and the customer's IP address is 

The initial step is to alter the memcached design and set the administration to tune in on the worker's private systems administration interface: 

To do as such, open the memcached.conf arrangement document: 

sudo nano /etc/memcached.conf

Find the line that starts with - l and supplant with the worker IP address 


Restart the Memcached administration for the progressions to produce results: 

sudo systemctl restart memcached

When the administration is arranged, the following stage is to open the memcached port in the firewall . 

sudo ufw allow from to any port 11211

Connecting to Memcached

There are numerous executions of memcached customers composed for various programming dialects. 


To utilize Memcached as a reserving information base for your PHP application, for example, WordPress, Drupal, Joomla or Magento, you have to introduce the php-memcached augmentation: 

sudo apt install php-memcached


There are a few Python libraries for connecting with memcache. You can introduce your favored library utilizing pip : 

sudo apt install php-memcached
pip install python-memcached


We've told you the best way to introduce Memcached on Ubuntu 20.04. For more data on this point, counsel Memcached Wiki . 

In the event that you have any inquiries or input, don't hesitate to remark underneath