CentOS系统更换yum源(repomd.xml not found解决方案)
CentOS系统更换yum源
问题
当初瞎鼓捣服务器,更换yum源为aliyun的,奈何阿里的源最近全部打不开,导致yum安装不了,一直报错:
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”
Trying other mirror.
http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - “couldn’t connect to host”
Trying other mirror.
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’”
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
在网上查了些资料,总算弄懂应该怎么处理了,但是找不到一个对应的源,所以还原默认了;
1. 查询服务器的系统版本
[root@nys yum.repos.d]# rpm -qi centos-release
Name : centos-release Relocations: (not relocatable)
Version : 6 Vendor: CentOS
Release : 10.el6.centos.12.3 Build Date: Tue 26 Jun 2018 10:52:41 PM CST
Install Date: Mon 23 Jul 2018 11:48:26 AM CST Build Host: x86-01.bsys.centos.org
Group : System Environment/Base Source RPM: centos-release-6-10.el6.centos.12.3.src.rpm
Size : 38232 License: GPLv2
Signature : RSA/SHA1, Tue 26 Jun 2018 11:35:30 PM CST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem <http://bugs.centos.org>
Summary : CentOS release file
Description :
CentOS release files
如上:Version,Release两项,当前服务器操作系统的版本就是:6.10
2. 更换yum源
- 进入yum配置文件目录
cd /etc/yum.repos.d[root@nys yum.repos.d]# ll
total 60
drwxr-xr-x 2 root root 4096 Oct 17 2017 backup
-rw-r--r-- 1 root root 1901 Jan 5 15:35 CentOS-Base.repo #此文件为yum使用的源配置
-rw-r--r-- 1 root root 1991 Jun 26 2018 CentOS-Base.repo.rpmnew
-rw-r--r-- 1 root root 647 Jun 26 2018 CentOS-Debuginfo.repo
-rw-r--r-- 1 root root 289 Jun 26 2018 CentOS-fasttrack.repo
-rw-r--r-- 1 root root 630 Jun 26 2018 CentOS-Media.repo
-rw-r--r-- 1 root root 8854 Jun 26 2018 CentOS-Vault.repo
-r--r--r-- 1 root root 664 May 11 2018 epel.repo
-rw-r--r-- 1 root root 957 Nov 5 2012 epel.repo.rpmnew
-rw-r--r-- 1 root root 1056 Nov 5 2012 epel-testing.repo
-rw-r--r-- 1 root root 206 Aug 20 17:58 influxdb.repo
- 确保yum源可访问,此处用的163源
http://mirrors.163.com/centos/6.10/
- 可以查看网易的源说明:
http://mirrors.163.com/.help/
- 下载对应版本的163源:
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
- 替换源文件到Base:
sudo cp CentOS6-Base-163.repo CentOS-Base.repo
- 更换Base文件中的路径为指定版本号:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#[base]
name=CentOS-$releasever - Base - 163.com
#此处路径需要替换为真实可访问地址
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful
--More--(51%)
* 需要将$releasever替换为当前系统版本号:6.10,对应可访问的163源路径
http://mirrors.163.com/centos/6.10/
- 使用vim替换:
:%s/$releasever/6.10/g
- 仅展示部分替换后的文件内容:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#[base]
name=CentOS-6.10 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6.10/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.10&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates
[updates]
name=CentOS-6.10 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6.10/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.10&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6--More--(51%)
3. 更新yum
#重置缓存
yum makecache
其它可参考执行的命令
#检查可以更新的软件包
yum check-update #更新所有的软件包
yum update #更新特定的软件包
yum update kernel #大规模的升级
yum upgrade#清楚缓存中rpm包文件
yum clean packages #清楚缓存中rpm的头文件
yum clean headers #清除缓存中旧的头文件
yum clean old headers #清除缓存中旧的rpm头文件和包文件
yum clean all
如果不成功,还原为默认源配置文件
- CentOS-Base.repo 源文件内容,需要将版本6改为7,因为6版本repomd.xml文件已经没有了,只能从7版本开始
http://mirror.centos.org/centos/7/os/x86_64/repodata/
[root@nys yum.repos.d]# cat CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#[base]
name=CentOS-7 - Base
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#released updates
[updates]
name=CentOS-7 - Updates
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that may be useful
[extras]
name=CentOS-7 - Extras
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users
[contrib]
name=CentOS-7 - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=contrib&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
- 更新epel.repo文件内容,将6改为7:
[root@nys yum.repos.d]# more epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.aliyun.com/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://mirrors.aliyun.com/epel/7/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://mirrors.aliyun.com/epel/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0
- 清楚缓存并重置
yum clean allyum makecacheyum -y update
CentOS系统更换yum源(repomd.xml not found解决方案)相关推荐
- CentOS 7 更换 yum 源
导语 上次买的服务器是腾讯云的,默认的 yum 源还是很快的.还有一台 vps ,这次用它来操作. yum yum命令是在Fedora和RedHat以及SUSE中基于rpm的软件包管理器,它可以使系统 ...
- Linux系统更换yum源的常用方法
一.前言 经常在进行环境部署时,需要安装各种各样的安装包,有时会碰见依赖库无法安装等问题,大多情况下是因为yum镜像库的配置问题. 接下来就说说常见的更换yum源的方法 二.更换yum源方法 1.更换 ...
- CentOS 8更换yum源,顺便扒一下国内常用的开源镜像站
测试环境中安装有一台CentOS 8系统,使用yum更新发现原来安装的yum源已经下架,无法正常更新,最后通过更换Centos-vault解决掉问题: [root@localhost ~]# wget ...
- Centos系统更改yum源为163
Centos安装好之后,按照网上教程对yum源进行修改,但更新之后发现总是提示更新失败,到163网站上查找资源发现目前大部分网上的教程都写错地址了,呵呵 下面是正确的办法,请参考 1.进入存放源配置的 ...
- centos 7 更换yum源
# wget -0 /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo # yum cl ...
- CentOS 6 EOL后如何更换yum源?
CentOS 开发者邮件列表显示,CentOS 6 已于11月30日 EOL,如果由于某种原因,您被困在 CentOS 操作系统的现在EOL(生命的尽头)版本,您将无法再yum upgrade成功运行 ...
- centos6 安装 mantisbt-1.2.8 —— (3)Linux系统下yum源配置(Centos 6)
Linux系统下yum源的配置(阿里云): 1.备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.ba ...
- CentOS 8 如何更换yum源
CentOS 8 如何更换yum源 前言 一.问题复现及分析 二.替换yum源 三.替换路径 结语 前言 闲着没事,本萌又开始折腾我的云服务器了.这次从Windows装回Linux时,竟然发现yum源 ...
- 更换yum源,安装扩展源,yum下载rpm包,源码包安装软件
2019独角兽企业重金招聘Python工程师标准>>> 更换国内yum源 我们的Linux中默认的yum源是国外的,有的时候网络不好,而我么需要下载的包过大的时候更换成国内的yum源 ...
最新文章
- 谈谈服务雪崩、降级与熔断
- 函数式编程语言python-函数式编程初探
- instancetype和id的区别
- [Medical Image Processing] 2. GrayScale Histogram and Threshold-【Isodata Algorithm】
- MyEclipse设置文件编码
- 如果你也会C#,那不妨了解下F#(4):了解函数及常用函数
- java编程石头剪刀布_java 开发的石头,剪刀,布的游戏 demo
- python数据结构与算法分析_数据结构和算法分析
- Qt工作笔记-两种方法从容器中筛选出父类和子类(继承法、typeid法)
- linux ftp远程更新,用ftp远程安装linux
- 20061008: IntelliJ Idea 6
- Spark 异步Action
- 形容女人的词语大全(坏与好)
- Log4J文件路径设置
- glob库:文件名的匹配
- 小观matlab插值函数
- linux(rhel) rescue修复详解
- 如何保持福禄克CFP2-100-Q、OFP2-100-Q等光纤测试仪器的洁净?
- Java MediaMetadataCompat
- 技巧分享:wps文件怎么转换成word格式?
热门文章
- VS2005 Web Application Project启用WSE(Ver 3.0)的方法
- 计算机组装维修中级试题,计算机维修工中级理论知识试卷.doc
- 安卓APP_ 布局(3) —— FrameLayout帧布局
- 一些比较少用但比较有用的linux命令备忘
- mysql使用 BETWEEN AND 查询
- 查看是否打印GC收集细节
- hive建立内部表映射hbase_快手 HBase 在千亿级用户特征数据分析中的应用与实践...
- 程序员难以攻克的十大难题
- asp点击按钮sql列求和_助你2020晋级互联网大数据阵营(一):轻轻松松学SQL
- html 科幻模板,html5酷炫宇宙科幻周年庆典专题动画模板