CentOS6 9原始碼編譯安裝memcached

2021-09-19 17:56:42 字數 2583 閱讀 7866

1.安裝所需依賴

yum install wget gcc gcc-c++
2.原始碼編譯安裝libevent庫

mkdir -p /usr/local/src

cd /usr/local/src

wget -c 

tar -zxvf libevent-2.1.8-stable.tar.gz

cd libevent-2.1.8-stable

./configure --prefix=/usr/local/libevent-2.1.8

make -j4

make install

3.安裝memcached

cd /usr/local/src

wget -c

tar -zxvf memcached-1.5.12.tar.gz

cd memcached-1.5.12

./configure --prefix=/usr/local/memcached \

--with-libevent=/usr/local/libevent-2.1.8

make -j4

make install

4.設定啟動指令碼

useradd -r -s /sbin/nologin -m memcached
cp /usr/local/src/memcached-1.5.12/scripts/memcached.sysv /etc/init.d/memcached
vim /etc/init.d/memcached
#port=11211

#user=nobody

#maxconn=1024

#cachesize=64

#options=""

......

start () {

echo -n $"starting $prog: "

# insure that /var/run/memcached has proper permissions

chown $user /var/run/memcached

daemon memcached

......

#將daemon memcached更改為daemon /usr/local/memcached/bin/memcached

vim /etc/sysconfig/memcached
port=11211

user=memcached

maxconn=1024

cachesize=64

options="-l 0.0.0.0,::1"

chown memcached.memcached /etc/sysconfig/memcached
mkdir -p /var/run/memcached

chown memcached.memcached /var/run/memcached

chkconfig --add memcached
chkconfig memcached on
[root@jmsite init.d]# service memcached start

正在啟動 memcached: [確定]

service memcached start 

service memcached stop

service memcached restart

service memcached reload

5.使用telnet測試

telnet 127.0.0.1 11211
[root@jmsite init.d]# telnet 127.0.0.1 11211

trying 127.0.0.1...

connected to 127.0.0.1.

escape character is '^]'.

set a 0 0 4

1234

stored

get a

value a 0 4

1234

endquit

connection closed by foreign host.

[root@jmsite init.d]#

memcached常用配置引數和命令請移步memcached常用配置引數和命令說明

CentOS 6 9編譯安裝Memcached

將之前放在onenote上的筆記放到部落格,如有錯誤還請指出 先編譯安裝libevent 安裝到 usr local libevent wget org files memcached 1.5 7.tar gztar zxvf memcached 1.x.x tar gz 解壓原始碼 cd memc...

centos6 9編譯安裝nginx

1 安裝nginx所需的依賴包 yum y install gcc gcc c autoconf automake zlib zlib devel openssl openssl devel pcre devel wget tar zxvf nginx 1.10.3.tar.gz 4 cd opt ...

Centos6 9編譯安裝httpd2 4

環境 一 安裝開發包組 三 編譯安裝 建立賬戶 編譯安裝 四 配置 1 配置httpd服務 user apache group apache 2 配置path變數 root centos6 httpd 2.4.27 vim etc profile.d httpd24.sh3 配置服務指令碼 4 新增...