Link.
1. Prepare files
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
wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz
2. Install 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. Install memcached
cd /usr/srctar -zxvf memcached-1.4.15.tar.gzcd memcached-1.4.15./configuremakemake install
4. Verify 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 content is 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-l 127.0.0.1-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 "$1" in
Start)
Start
;;
Stop)
Stop
;;
Restart)
Stop
Sleep 3
Start
;;
*)
Echo $ "Usage: $0 {START | stop | restart }"
Exit 1
Esac
Exit 0
Run the following command:
cd /etc/rc.d/init.dchmod 777 memcachedchkconfig --add memcached chkconfig --level 235 memcached onchkconfig --list | grep mem