centos7.5 安裝 redis5.0.5

服務器環境:CentOS Linux release 7.5.1804
redis版本:5.0.5

[root@localhost ~]# tar -zxvf redis-5.0.5.tar.gz
[root@localhost ~]# cd redis-5.0.5
# 安裝 Development Tools
[root@localhost redis-5.0.5]# yum groupinstall 'Development Tools' 

[root@localhost redis-5.0.5]# make

會出現如下錯誤

cd src && make all
make[1]: Entering directory `/root/redis-5.0.5/src'
    CC Makefile.dep
make[1]: Leaving directory `/root/redis-5.0.5/src'
make[1]: Entering directory `/root/redis-5.0.5/src'
    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
 #include <jemalloc/jemalloc.h>
                               ^
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/root/redis-5.0.5/src'
make: *** [all] Error 2
# 解決方案
[root@localhost redis-5.0.5]# cd deps/
[root@localhost deps]# make hiredis lua jemalloc linenoise  

重新編譯

[root@localhost deps]# cd ..
[root@localhost redis-5.0.5]# make

當出現如下信息,說明已經編譯通過了:

Hint: It's a good idea to run 'make test' ;)

make[1]: Leaving directory `/root/redis-5.0.5/src'

安裝

[root@localhost redis-5.0.5]# make install

安裝成功

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
make[1]: Leaving directory `/root/redis-5.0.5/src'

查看安裝文件以及目錄

[root@localhost redis-5.0.5]# cd /usr/local/bin/
[root@localhost bin]# ls |grep redis
redis-benchmark
redis-check-aof
redis-check-rdb
redis-cli
redis-sentinel
redis-server
[root@localhost bin]# 

通常我們把官方的配置文件拷貝出來,在他基礎上進行調整

[root@localhost bin]# cp ~/redis-5.0.5/redis.conf  /etc/
[root@localhost bin]# vim /etc/redis.conf 

更改如下幾行

bind 127.0.0.1  	# 訪問ip
protected-mode no # 關閉保護模式
daemonize yes     # 守護進程模式開啓

啓動

[root@localhost bin]# redis-server  /etc/redis.conf 
88005:C 28 Sep 2019 02:23:40.791 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
88005:C 28 Sep 2019 02:23:40.791 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=88005, just started
88005:C 28 Sep 2019 02:23:40.791 # Configuration loaded

查看是否啓動成功

[root@localhost bin]# ps -ef | grep redis
root      88006      1  0 02:23 ?        00:00:00 redis-server 127.0.0.1:6379
# 通過redis-cli 查看相關信息
[root@localhost bin]# redis-cli
127.0.0.1:6379> INFO

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章