当前位置: 首页 > news >正文

Linux相关问题整理

一、安装redis时make编译不通过

        安装redis6.0.8版本是,make编译时报错,直接原因是gcc版本过低,这里推荐在线安装,通过yum命令。
        但是在安装时,发现找不到gcc 9.0 、10.0相关的包。原因是scl没有配置为阿里云的,或者配置为阿里云的方式不正确。

yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ Loaded plugins:
fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras:
mirrors.aliyun.com * updates:
mirrors.aliyun.com No package devtoolset-10-gcc available.
No package devtoolset-10-gcc-c++ available.
Error: Nothing to do

        所以要先将Centos7 SCL源更换为阿里云:
        先安装 SCL 源:

yum install -y centos-release-scl centos-release-scl-rh

        安装完成后在 /etc/yum.repos.d 目录下会出现 CentOS-SCLo-scl.repo 和 CentOS-SCLo-scl-rh.repo 两个文件。安装后源默认启用。

        切换到源文件路径,更换镜像为阿里云:

   cd /etc/yum.repos.d

         编辑相关文件:

        CentOS-SCLo-scl.repo:

将 # baseurl=http://mirror.centos.org/centos/7/sclo/$basearch/sclo/ 修改为 baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/sclo/

删除以下行
mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo

最终为:
name=CentOS-7 - SCLo sclo baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/sclo/
gpgcheck=1
enabled=1

         CentOS-SCLo-scl-rh.repo:

将 #baseurl=http://mirror.centos.org/centos/7/sclo/$basearch/rh/ 修改为 baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/rh/

删除以下行
mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh

最终为:
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/rh/
gpgcheck=1
enabled=1

        刷新缓存:

 yum repolist && yum clean all && yum makecache

 

        上面配置完阿里云镜像之后,在进行gcc的升级。

        分别执行以下命令,这里以升级为9的版本为例:

        不同gcc版本安装

        升级版本:

yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

        更换为新的版本:

scl enable devtoolset-9 bash


echo “source /opt/rh/devtoolset-9/enable” >> /etc/profile

        查看版本是否更换完成: 

gcc -v

         可见版本已经升级成功:

[root@node1 redis-6.0.8]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-9/root/usr --mandir=/opt/rh/devtoolset-9/root/usr/share/man --infodir=/opt/rh/devtoolset-9/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-9.3.1-20200408/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)

        继续执行make命令安装redis:
        进入redis6.0.8文件夹,并执行make命令:

#cd到解压目录

cd redis-6.0.8

#清除缓存
make distclean
        

#执行make
make

        执行成功:

 

http://www.xdnf.cn/news/992287.html

相关文章:

  • 如何利用智能助手提升工作效率:从入门到实践
  • C语言学习20250611
  • Docker容器技术介绍,应用场景,安装应用以及项目部署
  • AUTOSAR图解==>AUTOSAR_TR_ModelingShowCases
  • D. Plus Minus Permutation
  • day28/60
  • 常用的免费网络API接口
  • 脑机新手指南(九):高性能脑文本通信:手写方式实现(上)
  • 【navigator.clipboard】复制链接弹出详情信息(模拟电商app)、页面中粘贴图片、复制文本自动添加版权信息
  • CentOS7自带的yum依然无法联网到官方源
  • 自我推荐一下
  • 关于亚马逊WOOT折扣力度
  • 中国北方GNSS业务站网积雪深度数据集(GSnow-CHINA v1.0, 12h/24h, 2013-2...
  • 【烧脑算法】三指针的降维打击:三线并行锁定解题细节
  • 数据隐私是什么?如何做好数据隐私规范?
  • Nuttx之mm_extend
  • Python数据类型大全:整型、浮点、字符串与布尔值
  • Codeforces 1029 Div3(ABCDE)
  • Windows10下利用VS2019编译JpegLib
  • seo优化新利器:AI如何让内容批量生成与排名提升双管齐下?
  • Gremlin创建schema(包括实体和关系)
  • 【质数】埃氏筛法、线性筛法(欧拉筛法)
  • 【Linux系统编程】System V
  • Java锁机制对决:ReadWriteLock vs StampedLock
  • 从0到1落地一个RAG智能客服系统
  • ConcurrentHashMap详解:原理、实现与并发控制
  • 专访伦敦发展促进署CEO:在AI与黄仁勋之外,伦敦为何给泡泡玛特和比亚迪留了C位?
  • MySQL优化器
  • 3.3.1_2 检错编码(循环冗余校验码)
  • 【完整源码+数据集+部署教程】安检爆炸物检测系统源码和数据集:改进yolo11-REPVGGOREPA