woff 發表於 2022-4-6 16:17:15

因應官方停止維護,替你的CentOS6更換Yum源


CentOS6系列於2020年11月30號之後停止維護了,故原本的yum源已無法使用,對於我這個從2012年就持續使用CentOS6到現在的忠實粉絲來說實在太可怕了,從來沒有想過這麼大品牌的OpenSource也有在網路上消失的一天,而且還來得這麼快


未更新前使用yum出現的錯誤訊息

# yum install php
Loaded plugins: fastestmirror Determining fastest mirrors YumRepo Error: All mirror URLs are not using ftp, http or file. Eg. Invalid release/repo/arch combination/ removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt Error: Cannot find a valid baseurl for repo: base
vi /etc/yum/pluginconf.d/fastestmirror.conf,將enabled參數改為零
enabled=0
verbose=0
always_print_best_host = true
socket_timeout=3
#Relative paths are relative to the cachedir (and so works for users as well
# as root).
hostfilepath=timedhosts.txt
maxhostfileage=10
maxthreads=15
#exclude=.gov, facebook
#include_only=.nl,.de,.uk,.ie
或是輸入以下指令快速修改

sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
備份原本的yum源

# cd /etc/yum.repos.d
# mv CentOS-Base.repo CentOS-Base.repo-bak
下載官方替代的vault源

curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Official.repo
清除緩存和更新套件資料庫

# yum clean all && yum makecache

國內很多站點都已經刪檔了,我這邊有找到美國加州大學的可用站點 http://mirrors.oit.uci.edu/centos/6.10/os/x86_64/
速度較快,先搶先贏唷!

文章出處
頁: [1]
查看完整版本: 因應官方停止維護,替你的CentOS6更換Yum源