In this tutorial, we’ll explain the Step to install Memcached in Centos or RHEL or Ubuntu. Memcache is a memory caching system and it is one of the popular and open source technology used for temporarily storing information which is basically used by the database.
The main purpose is used to boost the speed of application/website which is a heavily used database. Memcached runs in the memory itself and it doesn’t write to disk, this is why Memcache is very fast.
Memcached can be used with various web servers like Apache, Nginx, etc, also many programming languages like PHP, Python, Ruby have Memcached libraries. In this tutorial, we will see the steps to install Memcached in Centos RHEL and Ubuntu machine.
Steps to install Memcached in Centos or RHEL or Ubuntu
Pre-Requisites to install Memcached on Linux:
If you want to install Memcached with yum command then you need to install yum repository for Memcache
Install EPEL Repo for Linux – CentOS/RHEL
Memcache repo for CentOS 7 or RHEL 7
$ rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
Memcache repo for CentOS 6 / RHEL (64 Bit)
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Memcache repo for CentOS 6 / RHEL (32 Bit)
$ rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Memcache Installation steps on RHEL/CentOS
Once you have to install the required repository then you can install Memcached and required dependency using yum.
$ yum install Memcached php-memcached
The command to autostart Memcached service on boot
$ systemctl start memcached $ systemctl enable memcached
Memcache Installation steps on Ubuntu
For Ubuntu we don’t need any repository, you can directly install Memcached with below command
$ sudo apt-get install memcached php-memcached
How to Configuration Memcached
Command to see how to Memcached information
$ memcached –h
If we need to change or modify the default settings for Memcached, we can do that using its configuration file.
Change / Modify the default configuration of Memcached:
For CentOS/RHEL:
/etc/sysconfig/memcached
For Ubuntu
/etc/memcached.conf
Memcache Default port number is 11211
You can also do the max connection and cache size and all in the same configuration file.
After changes done in the Memcached configuration file, restart the Memcached service.
End of tutorial, we have seen all the steps to install Memcached in Centos or RHEL or Ubuntu.
Other Linux articles