1、安装libeven
memcached的使用需要libeven的支持,我们得先装上libeven。
官方网站:http://www.monkey.org/~provos/libevent/
libevent安装方式比较简单:
./configure && make
make install
检查是否 已经安装
ls -l /usr/local/lib/ | grep even
2、安装memcached
官方网站:http://www.danga.com/memcached/download.bml
memcached安装需要些参数:
以下是代码片段:
./configure
make
make install
3、测试
/usr/local/bin/memcached -h
正常ok
常见错误
/usr/local/bin/memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
解决办法
LD_DEBUG=libs memcached -v
输出
32179: find library=libevent-1.4.so.2 [0]; searching
32179: search cache=/etc/ld.so.cache
32179: search path=/lib/tls/i686/sse2:/lib/tls/i686:/lib/tls/sse2:/lib/tls:/lib/i686/sse2:/lib/i686:/lib/sse2:/lib:/usr/lib/tls/i686/sse2:/usr/lib/tls/i686:/usr/lib/tls/sse2:/usr/lib/tls:/usr/lib/i686/sse2:/usr/lib/i686:/usr/lib/sse2:/usr/lib(system search path)
32179: trying file=/lib/tls/i686/sse2/libevent-1.4.so.2
32179: trying file=/lib/tls/i686/libevent-1.4.so.2
32179: trying file=/lib/tls/sse2/libevent-1.4.so.2
32179: trying file=/lib/tls/libevent-1.4.so.2
32179: trying file=/lib/i686/sse2/libevent-1.4.so.2
32179: trying file=/lib/i686/libevent-1.4.so.2
32179: trying file=/lib/sse2/libevent-1.4.so.2
32179: &