CentOS 6.10 执行yum命令报错,尝试各种办法未解决

在CentOS 6.10 执行yum命令报错,尝试各种办法最终解决

错误如下:

[zjl@hadoop102 ~]$ sudo yum update
已加载插件:fastestmirror, refresh-packagekit, security
设置更新进程
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/centos-sclo-rh/mirrorlist.txt
错误:Cannot find a valid baseurl for repo: centos-sclo-rh

配置如下:

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

1.网络正常
2.尝试注释mirrolist,注释baseurl都不起作用
3.替换$releasever变量为6或6.10,均不起作用。
4.各种国内镜像站都配置过,没解决问题,貌似不支持低版本的Centos,6.10都不支持了。

解决方法

将以下官方镜像配置进配置文件,命令如下:

sudo vim CentOS-Base.repo

[base]
name=CentOS-6.10 - Base
failovermethod=priority
baseurl=http://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6.10 - Updates
failovermethod=priority
baseurl=http://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras
failovermethod=priority
baseurl=http://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus
failovermethod=priority
baseurl=http://vault.centos.org/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib
failovermethod=priority
baseurl=http://vault.centos.org/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

最后执行

sudo yum clean all && yum makecache

速度虽然慢点,但是还能用。

CentOS 6.10 执行yum命令报错,尝试各种办法未解决_第1张图片

你可能感兴趣的:(linux,yum,centos,shell)