CentOS6.9中使用yum install时提示:Cannot find a valid baseurl for repo: centos-sclo-rh
生活随笔
收集整理的這篇文章主要介紹了
CentOS6.9中使用yum install时提示:Cannot find a valid baseurl for repo: centos-sclo-rh
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
場(chǎng)景
CentOS的版本為6.9,在使用yum install 安裝相關(guān)依賴(lài)時(shí)提示:
Cannot find a valid baseurl for repo: centos-sclo-rh
?
注:
博客:
https://blog.csdn.net/badao_liumang_qizhi
關(guān)注公眾號(hào)
霸道的程序猿
獲取編程相關(guān)電子書(shū)、教程推送與免費(fèi)下載。
實(shí)現(xiàn)
原因是官方結(jié)束了對(duì)CentOS6的支持,導(dǎo)致在使用yum安裝或更新程序的時(shí)候出現(xiàn)錯(cuò)誤。
首先清空CenOS-Base.repo文件
echo > /etc/yum.repos.d/CentOS-Base.repo然后編輯該文件
vi /etc/yum.repos.d/CentOS-Base.repo然后按鍵盤(pán)上的i鍵進(jìn)入編輯模式,將下面的內(nèi)容復(fù)制進(jìn)去
[base] name=CentOS-$releasever - Base #mirrorlist=http://#mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra baseurl=https://vault.centos.org/6.10/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://#mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra baseurl=https://vault.centos.org/6.10/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://#mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra baseurl=https://vault.centos.org/6.10/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-$releasever - Plus #mirrorlist=http://#mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra baseurl=https://vault.centos.org/6.10/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-$releasever - Contrib #mirrorlist=http://#mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra baseurl=https://vault.centos.org/6.10/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6然后按Esc退出編輯模式,再輸入
:wq!保存并退出
然后刪除掉/etc/yum.repos.d/目錄下其他無(wú)關(guān)的repo文件
cd /etc/yum.repos.d/ ls | grep -v 'CentOS-Base.repo' | xargsrm然后重建yum緩存,更新并啟動(dòng)新的yum源
yum clean all && yummakecache此時(shí)需要等待一段時(shí)間,不要按回車(chē)。
?
總結(jié)
以上是生活随笔為你收集整理的CentOS6.9中使用yum install时提示:Cannot find a valid baseurl for repo: centos-sclo-rh的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: CentOS中启动Jar包、后台启动、查
- 下一篇: CentOS中怎样解压rar文件