问题概述:
手上有一台RedHat 6.9的虚拟机需要安装Redis数据库,版本为3.2.3,但是遇到一些困难,特此记录。
服务器版本:Red Hat Enterprise Linux Server release 6.9 (Santiago)
Redis版本:3.2.3
GCC版本:4.8.5
1 一开始make Redis时就提示
1 | 缺少编译库libgmp.so.10: cannot open shared object file: No such file |
我这边的解决办法是将libgmp.so.3.5.0给软连接到了libgmp.so.10
1 | ln -s libgmp.so.3.5.0 libgmp.so.10 |
这个得根据自己电脑的具体情况来
2 然后接着make提示
1 | jemalloc/jemalloc.h: No such file or directory |
这里需要科普一个知识点,就是Redis默认使用jemalloc为内存分配器,有另外一种解决办法就是make MALLOC=libc,这种办法就是libc内存碎片处理效果不及jemalloc,我这边的解决办法是给服务器安装jemalloc-5.0.1,但是在安装时输入./autoconf.sh,提示找不到autoconf commond,需要安装autoconf。
3 安装autoconf成功之后,接着make,提示
1 | expecting string instruction after rep' |
谷歌之后发现这个问题是因为gcc 4.8适配AMD芯片的BUG,原文如下
1 | The problem is that gcc 4.8 is generating "rep; ret" instructions to avoid a performance |
解决办法是升级binutils包的版本,联网电脑还好,直接执行
1 | yum update binutils |
离线电脑是下载binutils 2.27以上的rpm包上传到服务器
1 | rpm -ivh 包名 --nodeps --force |
不要下载源文件,编译时还是会提示req的那个问题,陷入死循环
升级完binutils之后再编译安装jemalloc包,安装成功之后再去编译Redis
1 | make distclean && make |
4 然后make test时候遇到
1 | you need tcl 8.5 or newer in order to run the redis test |
接着安装tcl以上的版本,安装完成之后make test又提示
1 | Test replication partial resync: ok psync (diskless: yes, reconnect: 1) in tests/integration/replication-psync.tcl |
我的解决办法是taskset -c 1 sudo make test,只用单核运行
通过之后运行make install即可,之后文件夹下会产生redis-server
评论已关闭