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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/275982.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

在类中用class时数据是共有还是私有_jvm学习笔记之class文件的加载、初始化

编写的java文件在要真正运行时&#xff0c;会首先被编译成 “.class"结尾的二进制文件&#xff0c;然后被虚拟机加载。那么在虚拟机中一个class文件要成为java实例&#xff0c;需要经历好几个步骤&#xff1a;1、装载&#xff1a;装载阶段由三个基本动作完成&#xff0c;要…

所有前端都要看的2D游戏化互动入门基础知识

背景现在越来越多的公司和APP开始使用游戏化的方式去做产品了&#xff0c;所谓游戏化&#xff0c;是指在非游戏环境中将游戏的思维和游戏的机制进行整合运用&#xff0c;以引导用户互动和使用的方法。支付宝里面的蚂蚁庄园、蚂蚁森林&#xff0c;通过游戏和公益的结合实现用户的…

江苏一动物园现“旋转活马” 园方:创意来自马术训练

中新网南通1月31日电 (记者唐娟)“旋转马设备采用同时容纳六匹马的遛马器组装而成&#xff0c;对马匹没有任何伤害&#xff0c;初衷是希望给小朋友一种全新体验&#xff0c;这才有了这个创意项目。”1月31日&#xff0c;针对活马版“旋转木马”引发的热议&#xff0c;江苏南通森…

Byte数组转换成string 的方法积累

.net的加密算法&#xff0c;返回的都是byte[] 类型&#xff0c;在存贮起来让人非常头疼&#xff0c;最简单的方法就是把byte[]转换成string来存贮&#xff0c;当然如果数据量大的话&#xff0c;另当别论。 所以我就把byte[]转换成string的方法做一个简单的积累与分析。目前有3种…

加快信息化建设对地方发展的_加快设计师职业发展的9种方法

加快信息化建设对地方发展的重点 (Top highlight)Over the past few months, I have had an increase in conversations with design students from various institutions, as well as early, to senior-level designers, researchers, & product managers from various co…

Docker:Nginx-Redis-Mysql-PHP 部署

Docker:Nginx-Redis-Mysql-PHP 部署 网络桥接 Docker容器之间默认网络隔离&#xff0c;需要使用桥接网络进行互通 创建网络 docker network create net-local docker network ls NETWORK ID NAME DRIVER SCOPE da9c8fc3dc80 bridge bridge local 78641…

epoll监听文件_介绍一下 Android Handler 中的 epoll 机制?

介绍一下 Android Handler 中的 epoll 机制&#xff1f;目录&#xff1a;IO 多路复用select、poll、epoll 对比epoll APIepoll 使用示例Handler 中的 epoll 源码分析IO 多路复用IO 多路复用是一种同步 IO 模型&#xff0c;实现一个线程可以监视多个文件句柄。一旦某个文件句柄就…

前端工程师的一大神器——puppeteer

大家好&#xff0c;我是若川。欢迎加我微信 ruochuan12&#xff0c;长期交流学习。今天推荐神器puppeteer&#xff0c;我猜有挺多人不知道。文章不长&#xff0c;看完有空也可以试玩。我18年也写过一篇puppeteer爬取生成pdf的文章&#xff0c;时间真快。前端使用puppeteer 爬虫…

selenium界面元素定位

一、 Selenium界面元素定位 本文元素定位以das2为例 #导入包 from selenium import webdriver #打开火狐驱动 driverwebdriver.Firefox() #访问网址 driver.get("http://192.168.3.217:8080/das/seatlogin.jsp ") 进行web页面自动化测试&#xff0c;对页面上…

vue.js ui_UI / UX开发:考虑Vue.js

vue.js uiBecause sometimes we have to add logic to our concepts, and Vue makes it a whole lot easier.因为有时我们必须在概念中添加逻辑&#xff0c;而Vue使其变得更加容易。 FULL DISCLOSURE: THIS IS NOT A COMPLETE JAVASCRIPT OR VUE COURSE. There’s no way I co…

Silverlight学习笔记十七BingMap(三)之地图的地区标识

如果我们需要在Bing Maps中加入一个小图钉标记&#xff0c;该如何实现了&#xff1f; Bing Maps控件已经为我们提供了这个功能&#xff0c;在Microsoft.Maps.MapControl名称空间下提供了实现图钉应用的图钉层Pushpin类用该类来实现普通标识 在Xaml中添加<map:Pushpin Locati…

win10查看pcie设备_壹拓网科技解密WIN10系统使用向日葵开机棒远程开机需要设置几个地方...

向日葵开机棒&#xff0c;是一款非常好用的远程智能远程开机硬件&#xff0c;它一头接网线&#xff0c;另外一头和被开电脑接在同一个路由器下&#xff0c;不需要和被开电脑或者设备直接连接&#xff0c;当然&#xff0c;被开电脑需要有线联网&#xff0c;暂时不支持使用无线方…

如何成为公司独当一面的工程师

大家好&#xff0c;我是若川。欢迎加我微信 ruochuan12&#xff0c;长期交流学习。今天推荐黄老师的这篇文章&#xff0c;你可能看到过了&#xff0c;但值得再看一遍。之前常有小伙伴问&#xff0c;大多情况下我都会分享这篇文章。点击下方卡片关注我、加个星标&#xff0c;或者…

webpack4.0配置记录(2)

接上一篇webpack4.0配置记录(1),继续记录学习webpack配置。 定义环境变量 new Webpack.DefinePlugin({//用来定义全局环境变量DEV:JSON.stringify(dev),FLAG:true }), webpack简单优化 noParsemodule:{noParse:/jquery/,//不去解析设置的包所依赖的关系,如jquery } ignorePlugi…

flex如何做响应式设计_响应式设计-您做错了!

flex如何做响应式设计Responsive design is not just about the web that automatically adjusts to different screen resolutions and resizeable images, but designs that are crucial for web performance.自适应设计不仅涉及可自动适应不同屏幕分辨率和可调整大小图像的网…

怎么查看和获取SQL Server实例名

查看實例名時可用 1、服务—SQL Server(实例名)&#xff0c;默认实例为(MSSQLSERVER) 或在连接企业管理时-查看本地实例 2、通過注冊表 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SQL Server/InstalledInstance 3、用命令 sqlcmd/osql sqlcmd -L sqlcmd -Lc osql -L 获…

30万手表推荐_今年六十岁生日,儿子说要送只30万的手表,请问有哪些推荐?...

关注腕表部落&#xff0c;尽享腕表生活一位读者向笔者提出这样一个问题&#xff1a;今年六十岁生日&#xff0c;儿子说要送只30万的手表&#xff0c;请问有哪些推荐&#xff1f;首先要恭喜这位老爷子&#xff0c;一来是生日马上就要到了&#xff0c;二来是还有这么孝顺而且慷慨…

关注博客

https://blog.51cto.com/oldboyhttps://blog.51cto.com/yw666转载于:https://blog.51cto.com/11732716/2348556

写 Node.js 代码,从学会调试开始

大家好&#xff0c;我是若川&#xff08;点这里加我微信 ruochuan12&#xff0c;长期交流学习&#xff09;。今天推荐这篇调试文章&#xff0c;熟悉我的读者都知道我写的源码文章都多次强调要调试&#xff0c;而且写了调试方法。点击下方卡片关注我、加个星标&#xff0c;或者查…

创建用户友好的表单

Forms are a common way to engage with users and could be a user’s first impression of your product. Since forms aren’t always the user’s favourite thing, it is essential to make filling out forms as easy as possible. Let’s go over a few tips for creati…