Linux安装Redis5.0.3

Installation

Download, extract and compile Redis with:

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

执行make时会报以下错误,这是由于系统中缺少gcc,安装一下即可:yum install gcc

MAKE hiredis
cd hiredis && make static
make[3]: 进入目录“/root/redis-5.0.3/deps/hiredis”
make[3]: Warning: File `Makefile' has modification time 88415 s in the future
gcc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
make[3]: gcc:命令未找到
make[3]: *** [net.o] 错误 127
make[3]: 离开目录“/root/redis-5.0.3/deps/hiredis”
make[2]: *** [hiredis] 错误 2
make[2]: 离开目录“/root/redis-5.0.3/deps”
make[1]: [persist-settings] 错误 2 (忽略)
    CC adlist.o
/bin/sh: cc: 未找到命令
make[1]: *** [adlist.o] 错误 127
make[1]: 离开目录“/root/redis-5.0.3/src”
make: *** [all] 错误 2

此时再次执行make命令还会报另一种如下的错误,这是因为libc不是默认的分配器, 默认的分配器是jemalloc(jemalloc被证明比libc有更少的fragmentation problems)但是如果你又没有jemalloc而只有libc,所以make会出错。解决办法:增加环境变量make MALLOC=libc

[root@localhost redis-5.0.3]# make
make: Warning: File `Makefile' has modification time 87860 s in the future
cd src && make all
make[1]: 进入目录“/root/redis-5.0.3/src”
make[1]: Warning: File `Makefile' has modification time 87860 s in the future
    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录
 #include <jemalloc/jemalloc.h>
                               ^
编译中断。
make[1]: *** [adlist.o] 错误 1
make[1]: 离开目录“/root/redis-5.0.3/src”
make: *** [all] 错误 2

The binaries that are now compiled are available in the src directory. Run Redis with:

$ src/redis-server

You can interact with Redis using the built-in client:

$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值