wget ***.***/centos/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget ***.***/centos/7.9.2009/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
wget ***.***/centos/7.9.2009/os/x86_64/Packages/yum-rhn-plugin-2.0.1-10.el7.noarch.rpm
wget ***.***/centos/7.9.2009/os/x86_64/Packages/yum-langpacks-0.4.2-7.el7.noarch.rpm
wget ***.***/centos/7.9.2009/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget ***.***/centos/7.9.2009/os/x86_64/Packages/PackageKit-yum-1.1.10-2.el7.centos.x86_64.rpm
wget ***.***/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm
【BaseOS】
name=BaseOS
baseurl=***.***/centos/$releasever/BaseOS/$basearch/os
gpgcheck=0
enable=1
【AppStream】
name=AppStream
baseurl=***.***/centos/$releasever/AppStream/$basearch/os/
enable=1
gpgcheck=0
【epel】
name=EPEL
baseurl=***.***/epel/8/Everything/x86_64/
gpgcheck=0
(0)
您好,以下是在Red Hat 7.9上更換為CentOS YUM源的步驟:
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo ***.***/repo/Centos-7.repo
sudo yum clean all
sudo yum makecache
vim:
sudo yum install vim -y
sudo mv /etc/yum.repos.d/CentOS-Base.repo.bak /etc/yum.repos.d/CentOS-Base.repo
sudo yum clean all
sudo yum makecache
(0)
暫無評論
檢查已安裝的 YUM 包:
rpm -qa | grep yum
輸出示例:yum-3.4.3-168.el7.noarch
、yum-utils-1.1.31-54.el7_8.noarch
。
強製卸載所有 YUM 包:
rpm -e --nodeps yum-* yum-utils-* yum-metadata-parser-* yum-rhn-plugin-*
需確保無殘留(rpm -qa | grep yum
無輸出)。
下載必要 RPM 包(以 163 鏡像源為例):
wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
需按順序安裝以避免依賴衝突。
按順序安裝 RPM 包:
rpm -ivh python-iniparse-*.rpm
rpm -ivh yum-metadata-parser-*.rpm
rpm -ivh yum-*.rpm yum-plugin-fastestmirror-*.rpm
確認無報錯信息。
備份原有源文件:
cd /etc/yum.repos.d
mkdir backup
mv *.repo backup/
防止原有 Red Hat 源幹擾。
下載並配置 CentOS 源文件(以阿裏雲為例):
wget -O /etc/yum.repos.d/CentOS-Base.repo ***.***/repo/Centos-7.repo
若使用其他鏡像(如華為雲),替換 URL 即可。
修正源文件版本號:
編輯 /etc/yum.repos.d/CentOS-Base.repo
,將 $releasever
替換為 7.9.2009
,避免變量解析錯誤。
清理並重建緩存:
yum clean all
yum makecache
確保新源生效。
驗證新源可用性:
yum install bind-utils # 測試安裝常用工具
若無報錯且下載正常,則更換成功
(0)
暫無評論
在 Red Hat Enterprise Linux 7.9 (RHEL 7.9) 上更換為 CentOS Yum 源,需要進行以下步驟:
mkdir -p /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/
這樣可以避免 RHEL 官方源影響新的 CentOS 源。
RHEL 7.9 兼容 CentOS 7.9 的 YUM 源,可以使用 CentOS Vault。
cat <<EOF > /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-7.9 - Base
baseurl=***.***/centos/7.9.2009/os/\$basearch/
gpgcheck=1
gpgkey=***.***/centos/7.9.2009/os/x86_64/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-7.9 - Updates
baseurl=***.***/centos/7.9.2009/updates/\$basearch/
gpgcheck=1
gpgkey=***.***/centos/7.9.2009/os/x86_64/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-7.9 - Extras
baseurl=***.***/centos/7.9.2009/extras/\$basearch/
gpgcheck=1
gpgkey=***.***/centos/7.9.2009/os/x86_64/RPM-GPG-KEY-CentOS-7
EOF
yum clean all
yum makecache
yum repolist
如果能正確列出 base
、updates
、extras
源,說明換源成功。
嚐試安裝 vim
或 wget
以檢查是否能正常使用:
yum install -y vim wget
如果安裝成功,說明 CentOS 源已經生效。
如果需要更快的下載速度,可以使用國內的 阿裏雲、清華、網易 鏡像:
# 阿裏雲
baseurl=***.***/centos-vault/7.9.2009/os/\$basearch/
# 清華大學
baseurl=***.***/centos-vault/7.9.2009/os/\$basearch/
# 網易
baseurl=http://mirrors.163.com/centos-vault/7.9.2009/os/\$basearch/
替換 baseurl
,然後執行 yum clean all && yum makecache
。
問題:RedHat Subscription 鎖定
subscription-manager remove --all
subscription-manager unregister
subscription-manager clean
問題:GPG 簽名失敗
gpgcheck=0
或者手動導入:
rpm --import ***.***/centos/7.9.2009/os/x86_64/RPM-GPG-KEY-CentOS-7
這樣,你的 RedHat 7.9 就能成功使用 CentOS 7.9 的 Yum 源了!🚀
(0)
暫無評論
親~登錄後才可以操作哦!
確定你的郵箱還未認證,請認證郵箱或綁定手機後進行當前操作
舉報
×
侵犯我的權益
×
侵犯了我企業的權益
×
抄襲了我的內容
×
原文鏈接或出處
誹謗我
×
對根叔社區有害的內容
×
不規範轉載
×
舉報說明
暫無評論