Redis安装以及常见错误

不废话直接上干货

安装:

wget http://download.redis.io/releases/redis-5.0.5.tar.gz
tar xf redis-5.0.5.tar.gz
cd redis-5.0.5/
make

也可以直接用yum但要先配置epel源,由于centos系统没有默认安装gcc所以得先安装gcc,否则make会报错

gcc安装:

yum -y install gcc

报错信息:

1.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"
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/data0/src/redis-5.0.5/src'
make: *** [all] Error 2
原因是jemalloc重载了Linux下的ANSI C的malloc和free函数。解决办法:make时添加参数。

make MALLOC=libc

2.make之后会出现一句提示:Hint: To run 'make test' is a good idea ;),直接make test。

3.如果make test出现提示:

You need tcl 8.5 or newer in order to run the Redis test

安装tcl即可解决

yum install -y tcl

验证:

  执行./src/redis-server 出现以下界面说明安装成功:

  

原文地址:https://www.cnblogs.com/Pynu/p/14393507.html