centos7安裝redis5
阿新 • • 發佈:2020-07-08
1.下載包redis-5.0.7.tar.gz
連結: https://pan.baidu.com/s/1hsDDZ0pZx5L_bZNLubZu7Q 提取碼: ghnc
2.安裝
[root@henry ~]# tar -xf redis-5.0.7.tar.gz -C /usr/share/ [root@henry ~]# cd /usr/share/redis-5.0.7/ [root@henry redis-5.0.7]# make #安裝 [root@henry redis-5.0.7]# mkdir -p /usr/local/reids-5.0.7 #建立redis的使用目錄 [root@henry redis-5.0.7]# cd /usr/local/reids-5.0.7 [root@henry reids-5.0.7]# cp /usr/share/redis-5.0.7/src/redis-server ./ #拷貝r服務端程式 [root@henry reids-5.0.7]# cp /usr/share/redis-5.0.7/src/redis-cli ./ #拷貝客戶端程式 [root@henry reids-5.0.7]# cp /usr/share/redis-5.0.7/redis.conf ./ #拷貝配置檔案 [root@henry reids-5.0.7]# sed -i '/^bind 127.0.0.1$/s/127.0.0.1/192.168.40.10/g' /usr/local/reids-5.0.7/redis.conf #192.168.40.10是你本機IP [root@henry reids-5.0.7]# sed -i '/protected-mode/s/yes/no/g' /usr/local/reids-5.0.7/redis.conf #關閉redis的保護模式 [root@henry reids-5.0.7]# sed -i '/daemonize/s/no/yes/g' /usr/local/reids-5.0.7/redis.conf #開啟redis的後臺執行模式 [root@henry reids-5.0.7]# sed -i 's/# requirepass foobared/requirepass 123123/g' /usr/local/reids-5.0.7/redis.conf #開啟redis的密碼並將密碼設定成123123 [root@henry reids-5.0.7]# sed -i 's/6379/16379/g' /usr/local/reids-5.0.7/redis.conf #修改redis的監聽埠為16379 [root@henry reids-5.0.7]# /usr/local/reids-5.0.7/redis-server /usr/local/reids-5.0.7/redis.conf #啟動redis [root@henry reids-5.0.7]# ./redis-cli -h 192.168.40.10 -a 123123 -p 16379 #測試連線 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. 192.168.40.10:16379> ping PONG 192.168.40.10:16379>