memcached1.6源码安装

memcached1.6源码安装


 

1.下载memcached和libevent

memcached安装依赖libevent,所以需要先安装libevent

https://libevent.org/

https://www.memcached.org/ 

[root@localhost ~]# wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
[root@localhost ~]# wget http://www.memcached.org/files/memcached-1.6.19.tar.gz

2.先安装libevent

[root@localhost ~]# tar -xvf libevent-2.1.12-stable.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/libevent-2.1.12-stable/
[root@localhost libevent-2.1.12-stable]# ./configure --prefix=/usr/  (如配置报错 需 yum -y install openssl  openssl-devel)
[root@localhost libevent-2.1.12-stable]# make && make install

测试libevent是否安装成功

[root@localhost ~]# ls -al /usr/lib | grep libevent
lrwxrwxrwx. 1 root root 21 Feb 7 16:09 libevent-2.1.so.7 -> libevent-2.1.so.7.0.1
-rwxr-xr-x. 1 root root 1327800 Feb 7 16:09 libevent-2.1.so.7.0.1
-rw-r--r--. 1 root root 2455942 Feb 7 16:09 libevent.a
lrwxrwxrwx. 1 root root 26 Feb 7 16:09 libevent_core-2.1.so.7 -> libevent_core-2.1.so.7.0.1
-rwxr-xr-x. 1 root root 843984 Feb 7 16:09 libevent_core-2.1.so.7.0.1
-rw-r--r--. 1 root root 1565814 Feb 7 16:09 libevent_core.a
-rwxr-xr-x. 1 root root 988 Feb 7 16:09 libevent_core.la
lrwxrwxrwx. 1 root root 26 Feb 7 16:09 libevent_core.so -> libevent_core-2.1.so.7.0.1
lrwxrwxrwx. 1 root root 27 Feb 7 16:09 libevent_extra-2.1.so.7 -> libevent_extra-2.1.so.7.0.1
-rwxr-xr-x. 1 root root 507480 Feb 7 16:09 libevent_extra-2.1.so.7.0.1
-rw-r--r--. 1 root root 890202 Feb 7 16:09 libevent_extra.a
-rwxr-xr-x. 1 root root 995 Feb 7 16:09 libevent_extra.la
lrwxrwxrwx. 1 root root 27 Feb 7 16:09 libevent_extra.so -> libevent_extra-2.1.so.7.0.1
-rwxr-xr-x. 1 root root 953 Feb 7 16:09 libevent.la
lrwxrwxrwx. 1 root root 29 Feb 7 16:09 libevent_openssl-2.1.so.7 -> libevent_openssl-2.1.so.7.0.1
-rwxr-xr-x. 1 root root 117704 Feb 7 16:09 libevent_openssl-2.1.so.7.0.1
-rw-r--r--. 1 root root 214274 Feb 7 16:09 libevent_openssl.a
-rwxr-xr-x. 1 root root 1024 Feb 7 16:09 libevent_openssl.la
lrwxrwxrwx. 1 root root 29 Feb 7 16:09 libevent_openssl.so -> libevent_openssl-2.1.so.7.0.1
lrwxrwxrwx. 1 root root 30 Feb 7 16:09 libevent_pthreads-2.1.so.7 -> libevent_pthreads-2.1.so.7.0.1
-rwxr-xr-x. 1 root root 24016 Feb 7 16:09 libevent_pthreads-2.1.so.7.0.1
-rw-r--r--. 1 root root 21982 Feb 7 16:09 libevent_pthreads.a
-rwxr-xr-x. 1 root root 1016 Feb 7 16:09 libevent_pthreads.la
lrwxrwxrwx. 1 root root 30 Feb 7 16:09 libevent_pthreads.so -> libevent_pthreads-2.1.so.7.0.1
lrwxrwxrwx. 1 root root 21 Feb 7 16:09 libevent.so -> libevent-2.1.so.7.0.1

3.安装memcached,同时需要安装中指定libevent的安装位置

[root@localhost ~]# tar -xvf memcached-1.6.19.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/memcached-1.6.19/
[root@localhost memcached-1.6.19]# ./configure --with-libevent=/usr/
[root@localhost memcached-1.6.19]# make && make install

安装完成后会把memcached放到 /usr/local/bin/memcached

测试是否成功安装memcached

[root@localhost ~]# ls -al /usr/local/bin/mem*
-rwxr-xr-x. 1 root root 963640 Feb 7 16:15 /usr/local/bin/memcached

 4.启动

使用memcached用户启动

[root@localhost ~]# useradd -r memcached -s /sbin/nologin
[root@localhost ~]# memcached -d -m 1024 -u memcached -U 0 -l 172.16.1.252 -p 11211 -c 4096 -t 64

 

posted @ 2021-10-31 16:33  Noleaf  阅读(104)  评论(0编辑  收藏  举报