In this tutorial, we will cover the installation of Memcached on CentOS 8 / RHEL 8. Memcached is an open source and free high-performance in-memory caching system with distributed architecture. It is licensed under the Revised BSD license.

Memcached is often used to speed up websites load time by reducing the number of queries that go to the database server. It does this by caching data and objects in RAM for quick retrieval.

Install Memcached on RHEL 8 / CentOS 8

The Memcached package is available on the default RHEL 8 repositories. Install it by running the following command in your terminal.

sudo yum -y install memcached

More details about installed package can be queried by:

$ rpm -qi  memcached
Name        : memcached
Epoch       : 0
Version     : 1.5.9
Release     : 2.el8
Architecture: x86_64
Install Date: Mon 04 Nov 2019 10:32:08 PM EAT
Group       : System Environment/Daemons
Size        : 288594
License     : BSD
Signature   : RSA/SHA256, Tue 02 Jul 2019 03:03:48 AM EAT, Key ID 05b555b38483c65d
Source RPM  : memcached-1.5.9-2.el8.src.rpm
Build Date  : Tue 14 May 2019 05:25:17 AM EAT
Build Host  :
Relocations : (not relocatable)
Packager    : CentOS Buildsys <[email protected]>
Vendor      : CentOS
URL         :

Start memcached service on CentOS 8 / RHEL 8

Now that the package is installed, you need to start the service and optionally set it to start on system boot.

$ sudo systemctl enable --now memcached.service 
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/memcached.service.

To check service status, run:

$ systemctl status memcached
● memcached.service - memcached daemon
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2018-12-31 10:26:15 EAT; 44s ago
Main PID: 10856 (memcached)
Tasks: 10 (limit: 5061)
Memory: 3.8M
CGroup: /system.slice/memcached.service
└─10856 /usr/bin/memcached -p 11211 -u memcached -m 64 -c 1024 -l,::1
Dec 31 10:26:15 rhel8 systemd[1]: Started memcached daemon.

Configuring Memcached on RHEL 8 / CentOS 8

Memcached configuration file is located in /etc/sysconfig/memcached. You can edit this file to set start options for Memcached service.

$ cat /etc/sysconfig/memcached

As an example, we will set the service to listen on all network interfaces instead of Change the OPTIONS line to below.


Restart the service after making the change.

sudo systemctl restart memcached

Confirm new listen address

$ ss -tunelp | grep 11211
tcp LISTEN 0 128* users:(("memcached",pid=10896,fd=28)) uid:995 ino:44588 sk:5 <->
tcp LISTEN 0 128 [::1]:11211 [::]:* users:(("memcached",pid=10896,fd=29)) uid:995 ino:44589 sk:7 v6only:1 <->

Configure Memcached Firewall

If you have clients that need to connect to your Memcached server, you’ll need to open the port on the firewall.

sudo firewall-cmd --add-port=11211/tcp --permanent
sudo firewall-cmd --reload

Enjoy using Memcached to speed up dynamic database-driven websites by caching data in memory. You can also check:

Install and Configure Redis Server on RHEL 8 / CentOS 8

Install and Configure Varnish Cache on CentOS / RHEL 8

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here