centos7 安装memcached缓存
1.安装memcached 依赖文件
[root@nginx ~]# cd /usr/local/src [root@nginx ~]# wget http://jaist.dl.sourceforge.net/project/levent/release-2.0.22-stable/libeven-2.0.22-stable.tar.gz [root@nginx ~]# tar -zxvf libevent-2.0.22-stable.tar.gz [root@nginx ~]# cd libevent-2.0.22-stable [root@nginx ~]#./configure --prefix=/usr/local/libevent-2.0.22 [root@nginx ~]# make [root@nginx ~]# make install [root@nginx ~]# ln -s /usr/local/libevent-2.0.22 /usr/local/libevent [root@nginx ~]# echo "/usr/local/libevent/lib/" > /etc/ld.so.conf.d/libevent.conf [root@nginx ~]# ldconfig
2.安装memcached
[root@nginx ~]# cd /usr/local/src/ [root@nginx src]# wget http://www.memcached.org/files/memcached-1.6.6.tar.gz [root@nginx src]# tar -zxvf memcached-1.6.6.tar.gz [root@nginx src]# cd memcached-1.6.6 [root@nginx memcached-1.6.6]# ./configure --prefix=/usr/local/memcached-1.6.6 --enable-64bit --with-libevent=/usr/local/libevent [root@nginx memcached-1.6.6]# make && make install [root@nginx memcached-1.6.6]# ln -sv /usr/local/memcached-1.6.6/ /usr/local/memcached
3.memcached 启动脚本
[root@nginx ~]# vim /usr/lib/systemd/system/memcached.service [Unit] Description=memcached daemon After=network.target [Service] EnvironmentFile=/usr/local/memcached/bin/memcached ExecStart=/usr/local/memcached/bin/memcached -p 11211 -u root -m 512 -c 200 $OPTIONS PrivateTmp=true ProtectSystem=full NoNewPrivileges=true PrivateDevices=true CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_SYS_RESOURCE RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX [Install] WantedBy=multi-user.target
4.启动memcahced
[root@nginx ~]# systemctl start memcached [root@nginx ~]# systemctl enable memcached

浙公网安备 33010602011771号