Redhat7 国内Yum源配置(解决yum命令Loaded plugins: product-id, search-disabled-repos, subscription-manager报错问题)

  1. 下载rpm包
    下载命令
wget http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/rpm-4.11.3-48.el7_9.x86_64.rpm
wget http://buildlogs-seed.centos.org/c7.00.03/yum-metadata-parser/20140609201710/1.1.4-10.el7.x86_64/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://buildlogs.centos.org/c7.1611.00/python-urlgrabber/20161105151400/3.10-8.el7.x86_64/python-urlgrabber-3.10-8.el7.noarch.rpm
wget https://buildlogs.centos.org/c7.1708.00/yum/20170805190830/3.4.3-154.el7.centos.x86_64/yum-3.4.3-154.el7.centos.noarch.rpm
wget https://1407433742.rsc.cdn77.org/c7.2003.u.aarch64/yum-utils/20200512162752/1.1.31-54.el7_8.aarch64/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget  https://linuxsoft.cern.ch/cern/centos/7/updates/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
wget https://buildlogs.cdn.centos.org/c7.2009.00.x86_64/yum/20201001170128/3.4.3-168.el7.centos.x86_64/yum-3.4.3-168.el7.centos.noarch.rpm
  1. 卸载原有的rpm和yum
rpm -qa|grep yum|xargs rpm -e --nodeps
  1. 安装rpm和yum
rpm -ivh --force rpm-4.11.3-48.el7_9.x86_64.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm python-urlgrabber-3.10-8.el7.noarch.rpm yum-3.4.3-168.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
  1. 配置阿里云仓库
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  1. 修改配置文件
sed -in 's#\$releasever#7#g' /etc/yum.repos.d/CentOS-Base.repo
sed -in 's#\$basearch#x86_64#g' /etc/yum.repos.d/CentOS-Base.repo
  1. 清理并重建yum缓存
yum clean all
yum makecache
posted @ 2025-05-09 17:47  是卡卡罗特啊  阅读(92)  评论(0)    收藏  举报