How to Install Memcached on CentOS 7

Install Memcached on CentOS 7

In this article, we will have explained the necessary steps to install and configure Memcached on CentOS 7. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Memcached is a free and open-source high-performance memory caching system. It’s typically used to cache database data, API calls or page rendering chunks in RAM to increase the application performance.

Install Memcached on CentOS

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

Step 2. Install Memcached.

Memcached packages are included in the default CentOS 7 repositories. Install Memcached using the following command:

Once the installation is completed, start and enable the Memcached service:

Step 3. Configure Memcached.

The default Memcached configuration file is located in the /etc/sysconfig/memcached file:

Set or update parameters as follows, customizing them to your needs:

This is a brief description of the parameters:

Restart the Memcached service for the changes to take effect:

Step 4. Install the Memcached PHP Extension.

You can install PHP extension to work with Memcached daemon with the command:

Now, restart Apache so that the changes take place:

Congratulation, you have learned how to install and configure Memcached on CentOS 7. If you have any question, please leave a comment below.