memcache安装

一、安装gcc

#yum-yinstallgcc

二、安装libevent

#wgethttp://www.monkey.org/~provos/libevent-2.0.12-stable.tar.gz

#tarzxflibevent-2.0.12-stable.tar.gz

#cdlibevent-2.0.12-stable

#./configure--prefix=/usr/local/lib

#make&&makeinstall

三、安装make

#yum-yinstallmake

四、下载安装最新版本:http://memcached.org/downloads

#wgethttp://memcached.org/files/memcached-1.4.20.tar.gz

#cdmemcached-1.4.20

#./configure--prefix=/usr/local/memcached--with-libevent=/usr/local/lib&&make&&makeinstall

五、配置启动

#vi/etc/rc.local

#!/bin/sh

#

#Thisscriptwillbeexecuted*after*alltheotherinitscripts.

#Youcanputyourowninitializationstuffinhereifyoudon't

#wanttodothefullSysVstyleinitstuff.

touch/var/lock/subsys/local

/usr/sbin/ntpdatentpupdate.tencentyun.com>/dev/null2>&1&

/usr/local/agenttools/agent/startagent.sh/usr/local/agenttools/agent/dev/null

#secu-tcs-agentbootstart,installatTueApr2917:21:38CST2014.

/usr/local/sa/agent/secu-tcs-agent-mon-safe.sh>/dev/null2>&1

/usr/local/memcached/bin/memcached-p12677-U0-d-r-uroot-m2040-c1024-t4

保存后退出,手动启动服务

#/usr/local/memcached/bin/memcached-p12677-U0-d-r-uroot-m2040-c1024-t4

注:如果出现/usr/local/memcached/bin/memcached:errorwhileloadingsharedlibraries:libevent-2.0.so.5:cannotopensharedobjectfile:Nosuchfileordirectory异常在/etc/ld.so.conf中加入/usr/local/lib这一行,保存之后,再运行:/sbin/ldconfig–v更新一下配置即可。

#vi/etc/ld.so.conf

#/sbin/ldconfig-V

六、测试memcached

#telnet127.0.0.112677

出现以下信息表示启动成功

Trying127.0.0.1...

Connectedto127.0.0.1.

Escapecharacteris'^]'.

相关推荐