Instructions to install Memcached on CentOS 7 - HOSTVN Blog

Install Memcached on CentOS - Memcached is a system that stores copies of objects and data that is accessed many times to speed up access. It is often used to optimize the download of data from databases for web-based applications.

In this article HOSTVN will show you how to install it Memcached Caching on VPS CentOS 7 helps to speed up your website.


  • VPS / Server using CentOS7
  • Installed PHP-FPM including php-devel
  • Ram from 2GB or more and Swap configuration

Instructions to install Memcached on CentOS 7

Step 1: Install EPEL

Redis is not available in the default yum repository so you need to enable EPEL yum repository on your server before installing redis. To activate EPEL, use the following command:

Step 2: Install Memcached and libmemcached

To install Memcached and libmemcached you use the following command

Step 3: Install igbinary

Igbinary is the replacement for the standard php adapter. Igbinary stores php data structures in binary form to help save memory cache as well as speed up loading. To know more about Igbinary you can see more here.

  • Installation for Igbinary PHP 5.6
  • Installation for Igbinary PHP 7
  • Note: If you get the following error message, you have not installed php-devel

To install php-devel you can run the following command

Step 4: Install Php memcached extension

Next you install Php memcached extension

  • Installed for Php memcached extension for PHP 5.6

Installed for Php memcached extension for PHP 7

Step 5: Configure Load Redis and Igbinary Module

In order for PHP to load Igbinary and Redis PHP extension, you create the file /etc/php.d/00-custom.ini with the following content:

Then you proceed to restart php-fpm

To check if the module has been loaded, use the following command


Step 6: Configure Memcached

You open the file / etc / sysconfig / memcached and delete all content inside then replace with the following content

Next start booting memcached

You can use the following command to check the status of memcached to see if mecached is working or not

Screenshot_67 - install Memcached on CentOS


Through this article HOSTVN I showed you how to install and configure Memcached to cache server. If you have any comments you can leave a comment below. Also you can see the Redis Installation Guide on CentOS 7.


About My name is Nguyen Manh Cuong. I was born in a poor village in Ba Vi district, HA NOI province - windy and sunny land. Currently. Mr Cuong.
Newer Posts Newer Posts Older Posts Older Posts


Post a Comment