Dragonfly Cloud is now available in the AWS Marketplace - learn more

Question: How to install Memcached in CentOS 7?

Answer

Memcached is a high-performance, distributed memory object caching server that stores data in memory to reduce the number of times an external database or an API must be accessed. Here's how you can install Memcached on CentOS 7:

  1. Update your system:
sudo yum update
  1. Install Memcached and its dependencies:
sudo yum install memcached
sudo yum install libmemcached-tools
  1. Start Memcached and configure it to start at boot time:
sudo systemctl start memcached
sudo systemctl enable memcached
  1. Verify that Memcached is running:
sudo systemctl status memcached
  1. By default, Memcached listens only on the loopback interface (localhost). If you want to allow incoming connections from other hosts, edit the configuration file /etc/sysconfig/memcached and change the OPTIONS line as follows:
OPTIONS="-l 0.0.0.0"

This will cause Memcached to listen on all available network interfaces.

  1. Restart Memcached for the changes to take effect:
sudo systemctl restart memcached

That's it! You have successfully installed and configured Memcached on CentOS 7.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Switch & save up to 80% 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost