Ubuntu10下Memcached1.4.5安装(转)
安装libevent2.0.10
这个是装Memcached1.4.5的前提条件。Ubuntu10已经有libevent1.4的了,可是版本过低。
改名-解压-编译安装
1.mvlibevent-2.0.10-stable.tar.gzlibevent2010.tar.gz
2.tar–zxvflibevent2010.tar.gz
3.cdlibevent-2.0.10-stable
4../configure-prefix=/usr/local
5.make
6.makeinstall
安装完后可以查看下/usr/local/lib是否有libevent等文件
1.ls-al/usr/local/lib|greplibevent
安装memcache1.4.5
1.tar–zxvfmemcached-1.4.5.tar.gz
2.cdmemcached-1.4.5
3../configure
4.make
5.sudomakeinstall
查看安装结果
ls-al/usr/local/bin/memcached
启动memcached
/usr/local/bin/memcached-d-m128-uroot-p11211–P/tmp/memcached.pid
参数:-d启动守护进程(后台运行)
-m分配给memcache使用的内存,单位是MB
-u运行memcached的用户
-l监听的服务器IP
-p监听的服务器端口,默认是11211
-P(大写)保存Memcache的pid文件,后面跟路径
启动Memcached报错
guangbo@guangbo-laptop:/usr/local/bin$/usr/local/bin/memcached-d-m128-uroot-p11211-P/tmp/memcached.pid
/usr/local/bin/memcached:errorwhileloadingsharedlibraries:libevent-2.0.so.5:cannotopensharedobjectfile:Nosuchfileordirectory
/usr/local/lib下安装有libevent2.0相关的包。
解决方法:建立软连接
sudoln-s/usr/local/lib/libevent-2.0.so.5/usr/lib/libevent-2.0.so.5
查看是否建立成功
guangbo@guangbo-laptop:/usr/local/lib$
ls-al/usr/lib|greplibevent
telnet测试memcached
telnet192.168.1.211211
Trying192.168.1.2...
Connectedto192.168.1.2.
Escapecharacteris'^]'
查看版本
1.version
VERSION1.4.5
stats查看memcached的详细信息
stats
STATpid9192
STATuptime352
STATtime1300907990
STATversion1.4.5
STATpointer_size32
…
Ok,安装memcached1.4.5成功。这次比较顺利,没有搞nginx那么多错。