Insight: Install Memcached On CentOS : Linux Caching Server
Let’s go through the process to install Memcached on CentOS operating system. Memcached is a caching server software. Memcached is a general-purpose distributed memory caching system.
Today we will see the various steps to install Memcached on CentOS operating system.
How To Install Memcached On CentOS
Before installing Memcached, you need to update your local software package index. And then install Memcached. It is available in the official CentOS repositories.
yum update yum install memcached
Now, Install libmemcached client library.
yum install libmemcached
Now, You need to secure Memcached configuration settings. We have to make assure that installed Memcached service is listening on the
127.0.0.1 local interface. Let’s edit:
In this file, Add the
-l 127.0.0.1 -U 0 to
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS="-l 127.0.0.1 -U 0"
It will protect server from denial of service attacks.
Now, Restart and enable your Memcached service:
systemctl restart memcached systemctl enable memcached
You can check the stats of the server using memcached-tool with the following command.
memcached-tool 127.0.0.1 stats
Meanwhile, Allow access to Memcached server by opening a port
11211 on your firewall.
firewall-cmd --permanent --zone=public --add-port=11211/tcp
Install Memcached PHP extension
yum install php-pecl-memcache
Install Memcached Perl Library
yum install perl-Cache-Memcached
Install Memcached Python Library
yum install python-memcached