CentOS7安裝Redis單實例
由於環境差異,安裝過程可能遇到各種各樣的問題,不要慌,根據錯誤提示解決即可。
1、下載redis
下載地址在:redis.io
比如把Redis安裝到/usr/local/soft/
cd /usr/local/soft/
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
2、解壓壓縮包
tar -zxvf redis-5.0.5.tar.gz
3、安裝gcc依賴
Redis是C語言編寫的,編譯需要
yum install gcc
4、編譯安裝
cd redis-5.0.5
make MALLOC=libc
將/usr/local/soft/redis-5.0.5/src目錄下二進制文件安裝到/usr/local/bin
拷貝目錄下的文件到指定目錄:
rsync -avzh ./a/* ./b/
cd src
make install
5、修改配置文件
默認的配置文件是/usr/local/soft/redis-5.0.5/redis.conf
後臺啓動
daemonize no
改成
daemonize yes
下面一行必須改成 bind 0.0.0.0 或註釋,否則只能在本機訪問
bind 127.0.0.1
如果需要密碼訪問,取消requirepass的註釋
requirepass yourpassword
6、使用指定配置文件啓動Redis(這個命令建議配置alias)
/usr/local/soft/redis-5.0.5/src/redis-server /usr/local/soft/redis-5.0.5/redis.conf
7、進入客戶端(這個命令建議配置alias)
/usr/local/soft/redis-5.0.5/src/redis-cli
8、停止redis(在客戶端中)
redis> shutdown
或
ps -aux | grep redis
kill -9 xxxx
附贈一個Win7可用的Redis可視化客戶端(redis-desktop-manager-0.8.3.3850)
鏈接:https://pan.baidu.com/s/1m6QoUaU0AKLfiXGhSNDJww
提取碼:ewa0
轉自
https://gper.club/articles/7e7e7f7ff7g5egc4g6b