centos下redis4.0.8單機快速安裝

1 下載

wget http://download.redis.io/releases/redis-4.0.8.tar.gz

2 解壓

tar -zxvf redis-4.0.8.tar.gz

3 安裝

cd redis-4.0.8
make && make install PREFIX=/usr/local/redis
  • 如果 make 編譯失敗,可執行以下命令安裝 編譯所需的環境
yum -y install gcc
yum -y install gcc-c++
  • 再次執行 make 編譯命令,如果報 error: jemalloc/jemalloc.h: No such file or directory等這種錯誤
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/data0/src/redis-2.6.2/src'
make: *** [all] Error 2

執行 : make MALLOC=libc 編譯完成後執行make install PREFIX=/usr/local/redis

4 移動配置文件到安裝目錄下

cd redis-4.0.8
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc

5 修改redis.conf

vim /usr/local/redis/etc/redis.conf
# 配置redis爲後臺啓動
將daemonize no 改成daemonize yes

# 給redis設置登錄密碼
requirepass xxx   #指定密碼xxx

# 遠程連接失敗問題
修改爲 bind 0.0.0.0

6 啓動redis

# 啓動
cd /usr/local/redis
./bin/redis-server /usr/local/redis/etc/redis.conf

# 停止
ps -ef|grep redis
kill -9 $PID

# 命令窗口
./bin/redis-cli -h 172.31.96.61 -p 6379 -n 0 -a iflytek
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章