更新GCC版本问题处理(Could not resolve host: mirrorlist.centos.org;)更换SCL配置源/SCL后yum使用不了

SCL:

在 Linux 系统中,更新 GCC(GNU Compiler Collection)编译器需要使用 Software Collections (SCL) 库的原因主要有以下几点:

https://wiki.centos.org/AdditionalResources/Repositories/SCLicon-default.png?t=N7T8https://wiki.centos.org/AdditionalResources/Repositories/SCL

1.版本隔离:

SCL 允许在同一系统上安装和使用多个版本的软件包,而不会影响系统的主要版本。这对于需要特定版本的编译器的开发工作非常有用,因为它可以避免与系统自带的编译器版本冲突。

2.兼容性:

有时候,系统自带的 GCC 版本可能太旧,无法满足某些开发需求,特别是当需要使用最新的编译器特性或修复旧版本中的问题时。SCL 提供了一种方式来安装和使用较新版本的 GCC,同时保持系统稳定性和兼容性。

3.易于管理:

使用 SCL,可以轻松地安装、切换和卸载不同版本的 GCC。

4.软件包集合:

SCL 不仅提供 GCC,还提供了一系列相关的开发工具和库。这意味着可以通过 SCL 安装一个完整的开发环境,包括编译器、调试器和性能分析工具等。

5.官方支持:

SCL 是由 Red Hat 官方提供的,因此它经过了严格的测试和验证,可以确保软件包的质量和稳定性。

问题复现:

在启动 RedisInsight 服务时候,发现如下报错:

[101864] Error loading Python lib '/tmp/_MEIqiNOAl/libpython3.10.so.1.0': dlopen: 
/lib64/libm.so.6: version `GLIBC_2.29' not found (required by 
/tmp/_MEIqiNOAl/libpython3.10.so.1.0)

这个错误信息表明在尝试加载一个 Python 库时遇到了问题,具体是 `/tmp/_MEIokXyW1/libpython3.10.so.1.0` 这个库文件。

错误的原因是系统缺少这个库文件所需的 GLIBC_2.29 版本的 `libm.so.6` 库。`libm.so.6` 是一个数学库,属于 GNU C 库(glibc)的一部分。
要解决这个问题,需要更新 glibc 库到至少是 2.29 版本;

[root@master ~]# yum -y install centos-release-scl 

安装 centos-release-scl 后,将能够访问 SCL 仓库,并安装 SCL 提供的软件包,但是在进行下一步安装 Development Toolset 8时候发现,yum无法使用:

Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=7&repo=sclo-rh error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"


 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer

没有魔法,无法直连外网;所以需要修改为centos-release-scl ;centos-release-scl-rh的国内源;

CentOS-SCLo-scl.repo

[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

CentOS-SCLo-scl-rh.repo 

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[root@master yum.repos.d]# yum repolist && yum clean all && yum makecache

尝试下载;成功

  • 27
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
回答: 当执行yum -y install gcc命令时,出现了错误"Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was"。这个错误通常是由于网络连接问题导致的。可以尝试以下解决方法:首先,将yum设置为阿里云,可以使用命令wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo来完成。然后,检查网络连接是否正常,可以使用命令ping www.baidu.com来测试。如果网络连接不正常,可以尝试修改DNS设置,找到文件/etc/sysconfig/network-scripts/ifcfg-ens33(注意ens33后面的数字是随机产生的),将其中的onboot改为yes,然后重新启动网络,使用命令service network restart,最后再次使用ping www.baidu.com来确认网络连接是否成功。如果网络连接正常,那么就可以正常执行yum -y install gcc命令了。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* *3* [Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stoc](https://blog.csdn.net/weixin_49114503/article/details/130324326)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=cont](https://blog.csdn.net/a2868221132/article/details/117261402)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

赵唯一

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值