Memcached 1.2.2 on RHEL/Centos using DAG rpms
In a previous article I have shown how you can install memcached from sources, and also how you can install it from debian packages. If you are running RHEL or Centos you have one other choice besides installing memcached from sources. This article will show how you can easily install memcached 1.2.2 and libevent 1.3b using DAG/rpmforge repository.
Add DAG/rpmforge repository to your system.
In case you don’t have already the DAG repository added to your yum/up2date sources, this is the first thing you should do. You can find some useful information on how you can do this on older post of Cornelius.
Once you have this working, you can proceed forward with the next step.
Installing memcached
DAG provides rpms for both memcached and libevent, and we can install them as easy as running:
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
=========================================================
Once this finishes you have a fully operational memcached daemon installed on the system.
Configuring memcached
The default configuration for the DAG memcached package can be found under:
/etc/sysconfig/memcached
PORT="11211"
USER="nobody"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""
You will probably want to tune these for your system, especially have CACHESIZE set to the maximum memory you want to allocate to memcached. You can use the OPTIONS line to add any other memcached command line parameters. For ex. if I want to have it listen on the private ip 192.168.0.1 I will change it to (where i have also increased the max memory to 1GB):
/etc/sysconfig/memcached
PORT="11211"
USER="nobody"
MAXCONN="1024"
CACHESIZE="1024"
**OPTIONS="-l 192.168.0.1"**
I hope you found this article useful. If you prefer to install memcached from sources you might find this older post useful: “HowTo install memcached from sources on Linux“. If you are looking how to build the php memcache module you can find more information about that on my older post…