Centos7 安装Redis,报错[adlist.o] Error jemalloc/jemalloc.h: No such file or directory

redis官网

https://redis.io/download

安装

$ wget http://download.redis.io/releases/redis-5.0.4.tar.gz
$ tar xzf redis-5.0.4.tar.gz
$ cd redis-5.0.4
$ make

启动

src/redis-server

make时候可能报错

xx command not found

CentOS7默认没有安装gcc,这会导致我们无法make成功。使用yum安装:

yum -y install gcc

error: jemalloc/jemalloc.h: No such file or directory

原因是jemalloc重载了Linux下的ANSI C的malloc和free函数。解决办法:make时添加参数。

make MALLOC=libc

make之后,会出现一句Hint提示

Hint: To run 'make test' is a good idea ;)
但是不测试,通常是可以使用的。若我们运行make test ,会有如下提示

$ make test
You need tcl 8.5 or newer in order to run the Redis test
make: ***[test] Error_1

解决办法是用yum安装tcl8.5(或去tcl的官方网站http://www.tcl.tk/下载8.5版本,并参考官网介绍进行安装)

yum install tcl

安装完之后再次执行测试

$ make test
.......
\o/ All tests passed without errors!

Cleanup: may take some time... OK
make[1]: Leaving directory `/usr/local/redis-5.0.4/src'

redis设置密码

临时生效

# ./redis-cli 
127.0.0.1:6379> config set requirepass 123456
OK
127.0.0.1:6379> 

永久生效

需更改redis.conf配置文件
requirepass passwoord
重启redis后生效

猜你喜欢

转载自www.cnblogs.com/aresxin/p/Centos7-an-zhuangRedis-bao-cuo-adlisto-Error-jemal.html
今日推荐