1. 环境介绍
- CentOS7 (未安装Development Tools)
2. 下载Redis5.0-rc3
wget -O redis-5.0-rc3.tar.gz https://github.com/antirez/redis/archive/5.0-rc3.tar.gz
3. 解压redis
tar -zxvf redis-5.0-rc3.tar.gz -C /usr/local
4. 编译并安装
cd /usr/local/redis-5.0-rc3
make
此时会出错:
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/usr/local/redis-5.0-rc3/src'
make: *** [all] Error 2
安装Development Tools
yum groupinstall 'Development Tools'
再次执行,还会报错
make
cd src && make all
make[1]: Entering directory `/usr/local/redis-5.0-rc3/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 `/usr/local/redis-5.0-rc3/src'
make: *** [all] Error 2
最后解决方案如下:
cd /usr/local/redis-5.0-rc3/deps; make hiredis lua jemalloc linenoise
编译完成后再次在/usr/local/redis-5.0-rc3
中执行make命令
cd /usr/local/redis-5.0-rc3
make
出现如下即编译成功
Hint: It's a good idea to run 'make test'