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.pswp.cn/news/275982.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/275982.shtml
英文地址,請注明出處:http://en.pswp.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…