[已解决] yum makecache报错:Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release

在linux使用yum指令安装软件时,需要更换阿里源 

1、备份原始的源文件
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.blk
2、 下载阿里云的源文件
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、清理缓存
yum clean all
4、加载新的源(阿里云)
yum makecache

在执行yum makecache指令时出现下面的报错,

根据报错信息应该也是源没有切换过来

解决方案: 

cd /etc/yum.repos.d/

备份以下两个文件

cp CentOS-SCLo-scl.repo CentOS-SCLo-scl.repo.blk

cp CentOS-SCLo-scl-rh.repo CentOS-SCLo-scl-rh.repo.blk

vim CentOS-SCLo-scl.repo 

将此文件内容全部替换为以下内容

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

[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-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

vim CentOS-SCLo-scl-rh.repo

将此文件内容全部替换为以下内容

# CentOS-SCLo-rh.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information

[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

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

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

[centos-sclo-rh-debuginfo]
name=CentOS-7 - SCLo rh 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 

当你在Linux系统上使用yum工具安装软件包时,遇到"Could not retrieve mirrorlist http://mirrorlist.centos.org"这样的错误,通常意味着yum无法从CentOS官方镜像列表获取可用的软件包源。这可能是由于以下几个原因: 1. **网络连接问题**:检查你的网络是否稳定,或者尝试重启路由器、清空DNS缓存。 2. **镜像站点不可达**:CentOS镜像地址可能暂时无法访问,你可以更换到其他的镜像源,比如国内的阿里云、清华大学等提供的镜像。 3. **防火墙限制**:确认系统防火墙或安全软件是否阻止了对特定网址的访问,如有需要,可以临时关闭或者添加规则允许访问。 4. **yum配置文件问题**:检查`/etc/yum.conf` 或者 `/etc/yum.repos.d/` 中的mirrors设置,看是否有正确的URL。 5. **时间同步问题**:确保系统的日期和时间与互联网的时间保持一致,因为一些服务器可能会基于时间戳验证请求。 解决这个问题的一个通用步骤是编辑yum的配置文件,更新或添加一个有效的镜像源。例如: ```bash sudo vi /etc/yum.repos.d/CentOS-Mirrors.list ``` 然后替换原有的镜像URL为可用的镜像,如: ``` [base] name=CentOS-$releasever - Base mirrorlist=https://mirrors.aliyun.com/repo/CentOS-\$releasever/$basearch/ enabled=1 gpgcheck=1 ``` 保存并关闭文件后,运行命令让yum更新新的配置: ```bash sudo yum makecache fast ``` 接着再次尝试安装软件包: ```bash sudo yum install [package-name] ```
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值