reids以make编译方式安装所遇到的问题及解决办法(Ubuntu环境下)

关于redis在ubuntu下的安装见http://www.redis.cn/download.html

在安装redis之前务必先执行以下命令

sudo apt-get update

在这期间可能会出现些问题:如果在编译的时候报错,则需要先安装make

sudo apt-get install make

如果出现以下的错误

cd src && make all
make[1]: Entering directory '/home/ubuntu/redis-4.0.11/src'
    CC adlist.o
/bin/sh: 1: cc: not found
Makefile:228: recipe for target 'adlist.o' failed
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory '/home/ubuntu/redis-4.0.11/src'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2

则可以安装 gcc

sudo apt-get install gcc

如果报错如下所示

cd src && make all
make[1]: Entering directory '/home/ubuntu/redis-4.0.11/src'
    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:10: fatal error: jemalloc/jemalloc.h: No such file or directory
 #include <jemalloc/jemalloc.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:228: recipe for target 'adlist.o' failed
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory '/home/ubuntu/redis-4.0.11/src'

则可以通过

make MALLOC=libc

来替代make命令,即可编译成功

详情见https://blog.csdn.net/libraryhu/article/details/64920124

猜你喜欢

转载自blog.csdn.net/qq_16069927/article/details/82899025
今日推荐