centos6.9安装yum报错

CentOS 6 yum源配置
本文介绍了解决CentOS 6系统中yum源配置问题的方法,包括备份原有repo文件、下载并配置新的repo文件、解决无法获取repo元数据的问题等步骤。

在这里插入图片描述

yum install -y ntp
加载插件:fastestmirror, 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/base/mirrorlist.txt
错误:Cannot find a valid baseurl for repo: base

1.备份:

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

3.运行 yum makecache 生成缓存

[root@hadoop101 yum.repos.d]# yum makecache 
已加载插件:fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
尝试其他镜像。
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
尝试其他镜像。
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'"
尝试其他镜像。
错误:Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
[root@hadoop101 yum.repos.d]#   

4.替换源文件配置, 使用https://mirrors.aliyun.com/centos-vault/
4.1官方: 非阿里云ECS用户会出现 Couldn’t resolve host ‘mirrors.cloud.aliyuncs.com’ 信息,不影响使用。用户也可自行修改相关配置: eg:

sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

4.2替换http成https

sed -i  's/http/https/g' /etc/yum.repos.d/CentOS-Base.repo

4.3替换版本,$releasever替换6.9, 6.9是我用的版本

sed -i  's/$releasever/6.9/g' /etc/yum.repos.d/CentOS-Base.repo

4.4替换centos为centos-vault

sed -i  's/centos/centos-vault/g' /etc/yum.repos.d/CentOS-Base.repo

5.yum clean all && yum makecache

[root@hadoop101 yum.repos.d]# yum clean all && yum makecache
已加载插件:fastestmirror, refresh-packagekit, security
Cleaning repos: base extras updates
清理一切
Cleaning up list of fastest mirrors
已加载插件:fastestmirror, refresh-packagekit, security
Determining fastest mirrors
base                                                     | 3.7 kB     00:00     
base/group_gz                                            | 226 kB     00:00     
base/filelists_db                                        | 6.4 MB     00:01     
base/primary_db                                          | 4.7 MB     00:00     
base/other_db                                            | 2.8 MB     00:00     
extras                                                   | 3.4 kB     00:00     
extras/filelists_db                                      |  38 kB     00:00     
extras/prestodelta                                       | 1.3 kB     00:00     
extras/primary_db                                        |  37 kB     00:00     
extras/other_db                                          |  51 kB     00:00     
updates                                                  | 3.4 kB     00:00     
updates/filelists_db                                     | 3.5 MB     00:00     
updates/prestodelta                                      | 390 kB     00:00     
updates/primary_db                                       | 5.4 MB     00:01     
updates/other_db                                         |  74 MB     00:12     
元数据缓存已建立
[root@hadoop101 yum.repos.d]# 

解决办法参考:
阿里yum源安装,centos 6已停止维护

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值