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

你可能感兴趣的:(系统运维)