软件下载地址:
libevent-2.1.4-alpha.tar.gz http://down.51cto.com/data/1985855
memcached-1.4.21.tar.gz http://down.51cto.com/data/1975956
1. libevent是安装 memcached的唯一前提条件。它是 memcached 所依赖的异步事件通知库。
# yum -y install gcc //安装libevent需要gcc
# tar zxf libevent-2.1.4-alpha.tar.gz
# cd libevent-2.1.4-alpha
# ./configure
# make
# make install
2.安装启动memcached
# tar zxf memcached-1.4.21.tar.gz
# cd memcached-1.4.21
# ./configure
# make && make install
# which memcached
启动测试时找不到共享库libevent-2.1.so.4
# whereis libevent-2.1.so.4
# cp /usr/local/lib/libevent-2.1.so.4 /usr/lib
# ldconfig
3. 启动脚本
# cat /data/shell/memcached.sh
#!/bin/sh
# memcached:MemCached Daemon
# chkconfig: - 90 25
# description:MemCached Daemon
# Source functionlibrary.
. /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 $"Shuttingdown memcached: "
killproc memcached
echo
}
MEMCACHED="/usr/local/bin/memcached"
[ -f $MEMCACHED ] || exit 1
# See how we werecalled.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0本文出自 “esoul” 博客,请务必保留此出处http://esoul.blog.51cto.com/7825461/1617106
原文:http://esoul.blog.51cto.com/7825461/1617106