1. Prepare documents
Cd/usr/src
Latest Version: Http://code.google.com/p/memcached/downloads/list
wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
2, Installation Libevent
CD/USR/SRCTAR-ZXVF LIBEVENT-2.0.20-STABLE.TAR.GZCD libevent-2.0.20-stable is configured with the./configure command to check the current environment./configure- Prefix=/usrmakemake Install
3, installation memcached
CD/USR/SRCTAR-ZXVF memcached-1.4.15.tar.gzcd Memcached-1.4.15./configuremakemake Install
4. Verify the installation
Ll/usr/local/bin | grep memcached
5.
Start
memcached
Ln-s/usr/lib/libevent-2.0.so.5/lib64/libevent-2.0.so.5/usr/local/bin/memcached-d-M 512-c 512-p 11211-u root-t 10
6.memcached start Stop script
Vi/etc/rc.d/init.d/memcached
The contents are as follows:
#!/bin/sh
#
# memcached:memcached Daemon
#
# Chkconfig:-90 25
# description:memcached Daemon
#
# Source function library.
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
#[${networking} = "No"] && exit 0
#[-r/etc/sysconfig/dund] | | Exit 0
#. /etc/sysconfig/dund
#[-Z "$DUNDARGS"] && exit 0
Start ()
{
Echo-n $ "Starting memcached:"
Daemon $MEMCACHED-u daemon-d-M 1024-u nobody-p 11211
Echo
}
Stop ()
{
Echo-n $ "Shutting down memcached:"
Killproc memcached
Echo
}
Memcached= "/usr/local/bin/memcached"
[-F $MEMCACHED] | | Exit 1
# See how we were called.
Case "$" in
Start
Start
;;
Stop
Stop
;;
Restart
Stop
Sleep 3
Start
;;
*)
echo $ "Usage: $ {Start|stop|restart}"
Exit 1
Esac
Exit 0
Then execute the following command:
CD /etc/rc.d/init.dchmod 777 memcachedchkconfig --add memcached chkconfig --level 235 memcached onchkconfig --list | grep mem
CentOS-6.4 installation memcached