CentOS7安装redis5.0

下载好redis5.0后解压在/tmp目录

1 cd /tmp/redis-5.0.3/
2 make

make过程中可能出现make[1]: *** [adlist.o] 错误 127,这是因为CentOS7默认没有安装gcc,所以安装gcc

1 yum -y install gcc
2 make

make过程中又可能出现zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory,zmalloc.h:55:2: error: #error "Newer version of jemalloc required",这样的错误,原因是jemalloc重载了Linux下的ANSI C的malloc和free函数,因此,make时添加参数

1 make MALLOC=libc

make成功后我们看到提示:Hint: To run 'make test' is a good idea ;) 

1 make test

在进行测试的时候,我们有看到了错误:You need tcl 8.5 or newer in order to run the Redis test,make: ***[test] Error_1,解决办法是用yum安装tcl

1 yum -y install tcl
2 make test

终于成功了!安装redis到指定目录

1 make install PREFIX=/usr/local/redis
2 mkdir /usr/local/redis/etc
3 cp redis.conf /usr/local/redis/etc

配置redis为后台启动

1 vim /usr/local/redis/etc/redis.conf #将daemonize no 改成daemonize yes

启动redis

1 redis-server /usr/local/redis/etc/redis.conf

关闭redis

1 pkill redis  
原文地址:https://www.cnblogs.com/guanghe/p/10220068.html