Memcached在Linux下的安装

Eave 2014.12.17 12:52

1、先安装libevent

下载地址:http://libevent.org

$ wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
$ tar -zxf libevent-2.0.22-stable.tar.gz
$ cd libevent-2.0.22-stable
$ ./configure --prefix=/usr/local/libevent
$ make && make install

2、安装memcached,同时需要在安装中指定libevent的安装位置

下载地址:http://memcached.org

$ wget http://www.memcached.org/files/memcached-1.4.25.tar.gz
$ tar -zxf memcached-1.4.25.tar.gz
$ cd memcached-1.4.25
$ ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
$ make && make install

3、添加memcached

$ /usr/sbin/groupadd memcached
$ /usr/sbin/useradd -M -g memcached memcached

4、设置开机启动Memcached的服务

$ vim /etc/init.d/memcached

示例文件: http://download.gramess.com/memcached/init.d/memcached

$ chmod 755 /etc/init.d/memcached
$ chkconfig --add memcached
$ chkconfig memcached on

5、启动Mencached

$ /etc/init.d/memcached start