Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install and Configure Memcached on CentOS 8 - DesignLinux

May 29 2020
designlinux 0 Comments

Memcached is an opensource, high-performance, and superfast in-memory key-value store that is designed for speeding up web applications. Among the popular web applications that rely on Memcached include FaceBook, Reddit, and Twitter.

In this article, you will learn how to install and configure a Memcached caching system on CentOS 8 Linux (same instructions also work on RHEL 8 Linux).

Installing Memcached in CentOS 8

By default, Memcached packages are included in CentOS 8 repositories. With this in mind, we are going to use the default dnf package manager to install Memcached alongside other packages.

$ sudo dnf install memcached libmemcached
Install Memcached in CentOS 8

Install Memcached in CentOS 8

To view detailed information about the Memcached package, run the following rpm command.

$ rpm -qi

The command will display details such as the version, release, architecture type, licensing, and release date of the package as shown below.

View Memcached Information

View Memcached Information

Configuring Memcached in CentOS 8

Now that we are done installing Memcached, we need to configure it so that other applications can interact with it. The configuration of Memcached is located in the /etc/sysconfig/memcached file.

By default, Memcached listens to port 11211 and is configured to listen only to the localhost system as shown in line number 5.

View Memcached Configuration

View Memcached Configuration

To configure Memcached so that applications from the remote systems can connect to the server, you need to change the localhost address 127.0.0.1 to the address of the remote host.

Let’s assume that we are in a private local network. Our Memcached server IP is 192.168.2.101 while the remote client’s IP where the application connecting to Memcached is 192.168.2.105.

We are going to replace the localhost address with the remote client’s IP 192.168.2.105 as shown.

Configure Memcached on CentOS 8

Configure Memcached on CentOS 8

Next, we need to open port 11211 on the firewall to allow traffic from the client host.

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

To confirm that port 11211 is opened on the firewall, execute the command.

$ sudo firewall-cmd --list-ports | grep 11211
Confirm Memcached Port

Confirm Memcached Port

Perfect!, the output confirms that the port is opened. Traffic from the remote client can now access the Memcached server.

Having wound up with the settings and configurations, start and enable Memcached as shown.

$ sudo systemctl start memcached
$ sudo systemctl enable memcached

To verify the status of Memcached, run the command.

$ sudo systemctl status memcached
Verify Memcached Status

Verify Memcached Status

The output is a confirmation that Memcached is up and running.

Enable Memcached for Applications

If you are running a PHP powered application such as Drupal, Magento or WordPress, install the php-pecl-memcache extension for your application to seamlessly communicate with the Memcached server.

$ sudo dnf install php-pecl-memcache

If you are running a Python application, use the pip package installer to install the following Python libraries.

$ pip3 install pymemcache --user
$ pip3 install python-memcached --user

And that’s it. In this guide, you learned how to install Memcached caching system on CentOS 8 server. For more information about Memcached check out the Memcached Wiki.

Sharing is Caring…
Share on FacebookShare on TwitterShare on LinkedinShare on Reddit

Related

Tags: CentOS Tips, open source caching tools, RHEL Tips

How to Install Varnish Cache for Apache on CentOS/RHEL 8

Prev Post

How to Configure IPv6 Network on CentOS/RHEL 8

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
  • 2
  • 82
  • 605,832

DesignLinux.com © All rights reserved

Go to mobile version