解决安装memcache出现configure: error: libevent is required. If it's already installed,

这里要安装memcached.但在编译的时候提示需要指定libevent库,可是在安装lnmp的候默认是已经安装过的.解决办法如下:

memcached需要libevent支持,所以首先安装libevent

查看系统是否已经安装libevent


# rpm -qa|grep libevent

如果有,不要高兴,先升级


#yum -y install libevent

测试libevent是不是已经安装成功


#ls -al /usr/lib | grep libevent

可以看到多个已经安装的类包安装memcached(http://memcached.org/)
可以先查看编译参数


# wget http://memcached.googlecode.com/files/memcached-1.4.8.tar.gz
# tar zxvf memcached-1.4.8.tar.gz
# cd memcached-1.4.8
# ./configure –help
# ./configure –prefix=/usr/local/memcached
# make
# make install

在这个时候,不一定会编译通过,依旧会出现:


checking for libevent directory… configure: error: libevent is required. You can get it from http://www.monkey.org/~provos/libevent/
If it’s already installed, specify its path using –with-libevent=/dir/

因为libevent 这个包是系统默认安装的,没有安装相应的开发所用的头文件。
所以,还要使用如下命令来安装:


yum install libevent-devel

再编辑,即可通过。。

启用Memcached,

/usr/local/memcached/bin/memcached -d -m 128 -l 192.168.1.1 -p 11211 -u root
============================================


memcached 启动报error while loading shared libraries: libevent-1.4.s解决办法:

原因是找不到libevent-1.4.so.2类库,解决办法如下:

使用LD_DEBUG=help ./memcached -v来确定 加载的类库路径,方法如下:


ln -s /usr/local/lib/libevent-1.4.so.2 /lib/libevent-1.4.so.2

你可能感兴趣的:(解决安装memcache出现configure: error: libevent is required. If it's already installed,)