Centos7.6安装redis6.0.1

   日期:2020-05-04     浏览:85    评论:0    
核心提示:Centos7.6安装redis6.0.1redis最新版下载地址安装redis报错1:/bin/s数据库

Centos7.6安装redis6.0.1

  • redis最新版下载地址
  • 安装redis
    • 报错1:/bin/sh: cc: command not found
    • 报错2:server.c:xxxx:xx: error: ‘xxxxxxxx’ has no member named ‘xxxxx’
  • 其他命令

redis最新版下载地址

  • github
  • redis官网

安装redis

[root@master ~]# ls
anaconda-ks.cfg  redis-6.0.1.tar.gz
[root@master ~]# tar xf redis-6.0.1.tar.gz 
[root@master ~]# cd redis-6.0.1/
[root@master ~]# make && make install


报错1:/bin/sh: cc: command not found

[root@master redis-6.0.1]# make
……
make[3]: cc: Command not found
make[3]: *** [net.o] Error 127
make[3]: Leaving directory `/root/redis-6.0.1/deps/hiredis' make[2]: *** [hiredis] Error 2 make[2]: Leaving directory `/root/redis-6.0.1/deps' make[1]: [persist-settings] Error 2 (ignored) CC adlist.o /bin/sh: cc: command not found make[1]: *** [adlist.o] Error 127 make[1]: Leaving directory `/root/redis-6.0.1/src'
make: *** [all] Error 2

解决办法:

yum -y install gcc

报错2:server.c:xxxx:xx: error: ‘xxxxxxxx’ has no member named ‘xxxxx’

[root@master redis-6.0.1]# make
……
server.c:5101:19: error: ‘struct redisServer’ has no member named ‘sofd’
         if (server.sofd > 0)
                   ^
server.c:5102:94: error: ‘struct redisServer’ has no member named ‘unixsocket’
             serverLog(LL_NOTICE,"The server is now ready to accept connections at %s", server.unixsocket);
                                                                                              ^
server.c:5103:19: error: ‘struct redisServer’ has no member named ‘supervised_mode’
         if (server.supervised_mode == SUPERVISED_SYSTEMD) {
                   ^
server.c:5104:24: error: ‘struct redisServer’ has no member named ‘masterhost’
             if (!server.masterhost) {
                        ^
server.c:5117:15: error: ‘struct redisServer’ has no member named ‘maxmemory’
     if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
               ^
server.c:5117:39: error: ‘struct redisServer’ has no member named ‘maxmemory’
……

解决办法:

# 查看gcc版本是否在5.3以上,centos7.6默认安装4.8.5
gcc -v
# 升级gcc到5.3及以上,如下:
升级到gcc 9.3:
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
需要注意的是scl命令启用只是临时的,退出shell或重启就会恢复原系统gcc版本。
如果要长期使用gcc 9.3的话:

echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
这样退出shell重新打开就是新版的gcc了
以下其他版本同理,修改devtoolset版本号即可。

其他命令

# 编译出错时,清出编译生成的文件
make distclean
# 编译安装到指定目录下
make PREFIX=/usr/local/redis install 
# 卸载
make uninstall
 
打赏
 本文转载自:网络 
所有权利归属于原作者,如文章来源标示错误或侵犯了您的权利请联系微信13520258486
更多>最近资讯中心
更多>最新资讯中心
0相关评论

推荐图文
推荐资讯中心
点击排行
最新信息
新手指南
采购商服务
供应商服务
交易安全
关注我们
手机网站:
新浪微博:
微信关注:

13520258486

周一至周五 9:00-18:00
(其他时间联系在线客服)

24小时在线客服