安裝Redis 6.2.0
wget http://download.redis.io/releases/redis-6.2.0.tar.gz
yum -y install gcc automake autoconf libtool make
tar - xzvf redis-6.2.0.tar.gz && redis-6.2.0.tar.gz
cd redis-6.2.0
make
cd src
make install PREFIX=/usr/local/ redis
若出現zmalloc.h:50:31: 致命錯誤:jemalloc/jemalloc.h:沒有那個檔案或目錄,則執行指令
make MALLOC=libc
cd ../
mkdir /etc/redis
mv redis.conf /etc/redis/
vim /etc/redis/redis.conf
//將daemonize no改成daemonize yes,輸入行數gg可以快速跳行。例如跳到第138行,輸入:138gg
//註解第70行bind
//第90行protected-mode改為no
//取消第502行註解並修改密碼
將Redis加入開機啟動
cat >> /etc/rc.local <
EOF
開啟Redis
/usr/local/redis/bin/redis-server /etc/redis/redis.conf
cat >> /etc/profile < ;
EOF
source /etc/profile
常用指令
redis-server /etc/ redis.conf //啟動Redis
pkill redis //停止Redis
重新啟動Redis:
#先查詢到Redis的pid後,kill#bin#bin#bin#[bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin#bin ]# ps -elf | grep -v grep | grep redis
root 20940 1 0 12:12 ? 00:00:18 ./redis-server *:6379
[root@localhost bin]# kill 20940 *:6379
[root@localhost bin]# kill 20940 *:6379
[root@localhost bin]# kill 20940 *:6379
[root@localhost bin]# kill 20940 *:6379
[root@localhost bin]# kill 20940 *:6379
[root@localhost bin]# kill 20940 *: ##[root@localhost bin]# redis-server redis.conf
採用Redis Desktop Manager遠端連接Redis伺服器
以上是怎麼用CentOS 7.5源碼包部署安裝Redis 6.2.0的詳細內容。更多資訊請關注PHP中文網其他相關文章!