Linux Administrator

How to Install Memcached on CentOS/RHEL Using DAG Rpmforge Repository

install-memcached
mm
Written by Santosh Prasad

In my previous article I show how you can install memcached from source. If you are using RHEL and CentOS system you have another method besides installing memcached from source.

In this article I will show how you can easily install memcached on libevent using DAG rpmforge repository.

Install DAG Rpmforge repository

First of all you have to add the DAG repository on your system.

# vim /etc/yum.repos.d/dag.repos

Add the below lines:

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

Next you will also need to import the GPG Key from the repository to make it work correctly. Follow the below command.

# rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

Once required repository added on your system now you can proceed forward with the next step.

Install Memcached

Now install memcached DAG provides rpms for both memcached and libevent follow the below command to install both.

# yum install memcached
=========================================================
Package                 Arch       Version          Repository        Size
=========================================================
Installing:
memcached               x86_64     1.2.2-1.el4.rf   rpmforge           81 k
Installing for dependencies:
libevent                x86_64     1.3b-1.el4.rf    rpmforge          127 k
=========================================================

Memcached successfully installed on your system.

Configure Memcached

Next configure memcached the default configuration file can be found under /etc/sysconfig/memcached

# cat /etc/sysconfig/memcached
PORT="11211"
USER="nobody"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""

Above is the default memcached configuration. If you want to tune these you can easly change the parameter especially for CACHESIZE and set the maximum memory to allocate to memcached. You can use the OPTIONS line to add any other memcached command line parameters. If you want to listen memcached on private IP change the private IP 192.168.0.5 and increase the max memory to 1GB like below:

# /etc/sysconfig/memcached
PORT="11211"
USER="nobody"
MAXCONN="1024"
CACHESIZE="1024"
**OPTIONS="-l 192.168.0.5"**

Save and close file.

You can also install the memcached from source. Follow the below link to install memcached from source.

Thank you! for visiting Look Linux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment