linux 安装redis3.2.8,centos7 安装redis 3.2.8 踩的那些坑

将下载的安装包上传到/opt下, 使用 :

tar -zxvf redis-3.2.8.tar.gz 解压安装包

cd redis-3.2.8 , 进入安装包

make ,编译

出现错误:

make[3]: gcc:命令未找到

make[3]: *** [net.o] 错误 127

make[3]: 离开目录“/opt/redis-3.2.8/deps/hiredis”

make[2]: *** [hiredis] 错误 2

make[2]: 离开目录“/opt/redis-3.2.8/deps”

make[1]: [persist-settings] 错误 2 (忽略)

CC adlist.o

/bin/sh: cc: 未找到命令

make[1]: *** [adlist.o] 错误 127

make[1]: 离开目录“/opt/redis-3.2.8/src”

make: *** [all] 错误 2

解决方法:安装gcc

yum -y install gcc automake autoconf libtool make 安装

安装完成后, 运行make ,出现如下错误:

make[1]: 进入目录“/opt/redis-3.2.8/src”

CC adlist.o

In file included from adlist.c:34:0:

zmalloc.h:50:31: **致命错误**:jemalloc/jemalloc.h:没有那个文件或目录

#include

^

编译中断。

make[1]: *** [adlist.o] 错误 1

make[1]: 离开目录“/opt/redis-3.2.8/src”

make: *** [all] 错误 2

解决方式: make改为make MALLOC=libc,推测是因为编译库的问题。

运行命令 make MALLOC= libc 完成后, 运行 make test ,看一下是否还有问题。

出现如下错误:

cd src && make test

make[1]: 进入目录“/opt/redis-3.2.8/src”

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

make[1]: *** [test] 错误 1

make[1]: 离开目录“/opt/redis-3.2.8/src”

make: *** [test] 错误 2

应该是tcl版本比较低导致,那就升级喽。

按命令执行如下命令:

wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz

sudo tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/

cd /usr/local/tcl8.6.1/unix/

sudo ./configure

sudo make

sudo make install

执行:wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz 命令后

出现如下错误: -bash: wget: 未找到命令

因为 centos7 是最小化安装,没有wget 命令 , 先安装:

yum install -y wget

安装完成之后再运行上面的命令。

安装tcl完成之后,重新加压redis 安装包。并运行make 命令。

进入src 目录 ,运行 redis-server, 出现如下界面表示运行成功。

[root@bogon src]# ./redis-server

2200:C 29 Mar 22:13:49.357 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf

2200:M 29 Mar 22:13:49.358 * Increased maximum number of open files to 10032 (it was originally set to 1024).

_._

_.-``__ ''-._

_.-`` `. `_. ''-._ Redis 3.2.8 (00000000/0) 64 bit

.-`` .-```. ```\/ _.,_ ''-._

( ' , .-` | `, ) Running in standalone mode

|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379

| `-._ `._ / _.-' | PID: 2200

`-._ `-._ `-./ _.-' _.-'

|`-._`-._ `-.__.-' _.-'_.-'|

| `-._`-._ _.-'_.-' | http://redis.io

`-._ `-._`-.__.-'_.-' _.-'

|`-._`-._ `-.__.-' _.-'_.-'|

| `-._`-._ _.-'_.-' |

`-._ `-._`-.__.-'_.-' _.-'

`-._ `-.__.-' _.-'

`-._ _.-'

`-.__.-'

2200:M 29 Mar 22:13:49.362 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

2200:M 29 Mar 22:13:49.362 # Server started, Redis version 3.2.8

2200:M 29 Mar 22:13:49.362 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

2200:M 29 Mar 22:13:49.363 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

2200:M 29 Mar 22:13:49.406 * DB loaded from disk: 0.044 seconds

2200:M 29 Mar 22:13:49.407 * The server is now ready to accept connections on port 6379

另起一个界面,运行,redis-cli来启动客户端 ,如下:

cc403be7f80d

启动客户端.png

可以运行如下命令,查看redis端口:

检测redis进程

ps -ef|grep redis

检测端口

netstat -lntp | grep 6379

至此redis 安装完成。 可以正常使用了, centos7 安装redis的坑还是蛮多的。 记录一下,留着以后备用。

少年听雨歌楼上,红烛昏罗帐。

壮年听雨客舟中,江阔云低,断雁叫西风。

感谢支持!

---起个名忒难

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值