Sunday, August 5, 2012

Compile memcached latest version on linux

Recently I've compiled latest memcached version from source :

cd /usr/src
wget http://memcached.org/latest
tar -zxf memcached*
cd memcached*
./configure --prefix=/usr --sysconfdir=/etc
chown -R nobody /usr/src

sudo -u nobody make
make install

#Debian :
cp ./scripts/memcached-init /etc/init.d/memcached

wget vps5.in/files/memcached.conf -P /etc
mkdir -p /usr/share/memcached
cp -R scripts /usr/share/memcached


#centos :
cp ./scripts/memcached.sysv /etc/init.d/memcached
echo -e "PORT=11211\nUSER=nobody\nMAXCONN=1024\nCACHESIZE=64\nOPTIONS=\"\"" > /etc/sysconfig/memcached
mkdir -p /var/run/memcached
ln -s /etc/sysconfig/memcached /etc/memcached.conf
#
chmod a+x /etc/init.d/memcached
chkconfig memcached on

For php usage of memcached you'll need to compile php5-memcache pecl library.

I wanted to use memcached cache for some high-trafficed joomla 1.5 but I've found that joomla 1.5 cache is broken and all cache types are redirected to file caching ! So I'll upgrade to newer joomla versions in future and start using the power of memcached soon ...

No comments:

Post a Comment