Centos 7 升级GCC时遇到 mirrorlist.centos.org; Unknown error“

问题描述

在执行如下操作的时候,

复制代码
yum install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

出现:

14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

网上搜索了一下,原因是 mirrorlist.centos.org 这个源停用了。哎~

建议还是用乌班图或者centos-8吧。

解决方法

centos7上的解决办法

使用如下的yum 源

CentOS-Base.repo

复制代码
[base]
name=CentOS-$releasever - Base
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

# released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

# additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

CentOS-SCLo-scl.repo

参考了Linux CentOs7系统scl镜像源失效问题_centos-sclo-scl-rh.repo-CSDN博客这个博客,感谢。

复制代码
# CentOS-SCLo-sclo.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=http://vault.centos.org/centos/7/sclo/$basearch/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo


[centos-sclo-sclo-testing]
name=CentOS-7 - SCLo sclo Testing
baseurl=http://buildlogs.centos.org/centos/7/sclo/$basearch/sclo/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-source]
name=CentOS-7 - SCLo sclo Sources
baseurl=http://vault.centos.org/centos/7/sclo/Source/sclo/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-debuginfo]
name=CentOS-7 - SCLo sclo Debuginfo
baseurl=http://debuginfo.centos.org/centos/7/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

yum clean all
yum makecache

下面就能正常升级了

复制代码
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

祝你好运

有问题可以交流呀

concat("求求QUN", "61480", "9646")

相关推荐
虎头金猫1 小时前
如何解决 403 错误:请求被拒绝,无法连接到服务器
运维·服务器·python·ubuntu·chatgpt·centos·bug
muxue1782 小时前
关于almalinux分区配置:
linux·运维·数据库
独行soc4 小时前
2025年渗透测试面试题总结-某服面试经验分享(附回答)(题目+回答)
linux·运维·服务器·网络安全·面试·职场和发展·渗透测试
C-20025 小时前
使用Deployment部署运行Nginx和Apache服务
运维·kubernetes·apache
sunshineine5 小时前
jupyter notebook运行简单程序
linux·windows·python
O。o.尊都假都5 小时前
UDP协议
linux·服务器·网络·网络协议·udp
leo·Thomas6 小时前
NetBox Docker 全功能部署方案(Ubuntu 22.04 + Docker)
运维·ubuntu·docker·容器·资产管理
天夏已微凉6 小时前
1.3.1 Linux音频框架alsa详细介绍
linux·音视频
惜.己6 小时前
linux中的常用命令(一)
linux·运维·服务器
lcw_lance6 小时前
数字孪生[IOC]常用10个技术栈(总括)
大数据·运维·人工智能