首頁 > 軟體

CentOS 5.11 使用yum源

2020-06-16 16:38:57

由於我是用的系統是CentOS 5.11以停止更新很多年,故此yum也不能用,找了很多方法,最終yum能穩定的執行在CentOS 5.11上,下面開始一一講解步驟:

1:首先更新yum源

地址:http://vault.centos.org/

網站是有各個版本映象的,所以 通過lsb_release -a查詢下,系統版本如圖

下面是我的yum源完整版本,下面會說出具體針對系統版本進行修改yum源方法:

 vim /etc/yum.repos.d/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-$releasever - Base
baseurl=http://vault.centos.org/5.11/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/5.11/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
baseurl=http://vault.centos.org/5.11/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/5.11/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/5.11/os/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://vault.centos.org/5.11/os/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

註:如果你的版本是5.10(舉例說明),開啟此網站,http://vault.centos.org,根據上述地址http://vault.centos.org/5.11/os/x86_64/來進行修改,比如系統是5.10的話,是x86_64的,我們可以修改成http://vault.centos.org/5.10/os/x86_64/,修改完成後,瀏覽器開啟輸入地址,看看是不是可以顯示出以下頁面:

如果顯示出上述頁面,那根據我上面的5.11版本的Centos源把baseurl=http://vault.centos.org/5.11/os/x86_64/ 修改成 baseurl=http://vault.centos.org/5.10/os/x86_64/(是上述檔案內容中,所有http://vault.centos.org/5.11/os/x86_64/地址),即可

修改完成後,儲存,使用如下命令進行測試

yum clean all

yum makecache

測試成功後,可用yum進行安裝、解除安裝軟體。


IT145.com E-mail:sddin#qq.com