日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > windows >内容正文

windows

CentOS系统更换yum源(repomd.xml not found解决方案)

發(fā)布時(shí)間:2023/12/9 windows 47 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOS系统更换yum源(repomd.xml not found解决方案) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

CentOS系統(tǒng)更換yum源

問題

當(dāng)初瞎鼓搗服務(wù)器,更換yum源為aliyun的,奈何阿里的源最近全部打不開,導(dǎo)致yum安裝不了,一直報(bào)錯(cuò):

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

在網(wǎng)上查了些資料,總算弄懂應(yīng)該怎么處理了,但是找不到一個(gè)對應(yīng)的源,所以還原默認(rèn)了;

1. 查詢服務(wù)器的系統(tǒng)版本

[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兩項(xiàng),當(dāng)前服務(wù)器操作系統(tǒng)的版本就是:6.10

2. 更換yum源

  • 進(jìn)入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/

  • 可以查看網(wǎng)易的源說明:

http://mirrors.163.com/.help/

  • 下載對應(yīng)版本的163源:

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

  • 替換源文件到Base:

sudo cp CentOS6-Base-163.repo CentOS-Base.repo

  • 更換Base文件中的路徑為指定版本號(hào):
# 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 #此處路徑需要替換為真實(shí)可訪問地址 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替換為當(dāng)前系統(tǒng)版本號(hào):6.10,對應(yīng)可訪問的163源路徑

http://mirrors.163.com/centos/6.10/

  • 使用vim替換:

:%s/$releasever/6.10/g

  • 僅展示部分替換后的文件內(nèi)容:
# 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

其它可參考執(zhí)行的命令

#檢查可以更新的軟件包 yum check-update #更新所有的軟件包 yum update #更新特定的軟件包 yum update kernel #大規(guī)模的升級 yum upgrade#清楚緩存中rpm包文件 yum clean packages #清楚緩存中rpm的頭文件 yum clean headers #清除緩存中舊的頭文件 yum clean old headers #清除緩存中舊的rpm頭文件和包文件 yum clean all

如果不成功,還原為默認(rèn)源配置文件

  • CentOS-Base.repo 源文件內(nèi)容,需要將版本6改為7,因?yàn)?版本repomd.xml文件已經(jīng)沒有了,只能從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文件內(nèi)容,將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

總結(jié)

以上是生活随笔為你收集整理的CentOS系统更换yum源(repomd.xml not found解决方案)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。