Installing memcached in ubuntu & rhelcentos

Page 1

LinuxTechLab.com

Installing MEMCACHED in Ubuntu & RHEL/CentOS

Originally published on

LinuxTechLab.com


Memcached is a very popular, open source distributed memory caching system, that is used for temporarily storing information that is most likely to be used by a databse. It is primarily used to boost the speed of websites that uses heavy databases, but its use are not limited with database only, memcaahed can be used with other object types as well. Memcached does not write any data to disk & as it runs in the memory to run, it is very fast. Memcacahed 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 are going to learn to install memcached on RHEL & CentOS machines.

Pre-Requisites EPEL repository enabled for CentOS and RHEL systems Memcached packages are not available in the default RHEL/CentOS repositories & we need to enable EPEL repository to install it. To enable the EPEL repository, run the below mentioned commands (corresponding to the operating system being used)

RHEL/CentOS 7 $ rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-710.noarch.rpm

RHEL/CentOS 6 (64 Bit) $ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-68.noarch.rpm

RHEL/CentOS 6 (32 Bit) $ rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-68.noarch.rpm

Installation on CentOS/RHEL Once the EPEL repository has been enabled, we can install memcached & its requred dependencies using yum, $ yum install memcached php-memcached


That’s it, this will install memcached on the system. We now need to start its service & enable it for the boot time, $ systemctl start memcached $ systemctl enable memcached

Installation on Ubuntu For Ubuntu machines, we need not add any extra repositories & can install memcached by running, $ sudo apt-get install memcached php-memcached Once the package has been installed we will restart the apache server (as memcached comes pre-configured) to implement the changes.

Configuration To see all the information regarding the memcached using the follwoing command, $ memcached -h If we need to change or modify the default settings for Memcached, we can do that using its configuration file. The default configuration for CentOS/RHEL, is at the location ‘/etc/sysconfig/memcached’ & for Ubuntu, configuration file is located at ‘/etc/memcached.conf’. If changes are needed to be made to memcached, they are to be done in this file. Changes that can be made include port number (default 11211), Maximum connections , cache size etc. After making changes to the file, be sure to restart the service to implement the changes. If you think we have helped you or just want to support us, please consider these :Connect to us: Facebook | Twitter | Google Plus

LinuxTechLab.com



Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.