redhat7 重新配置yum源

在RedHat下使用yum安装软件时出现This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
就是要注册交费才能使用yum,只好自己重新配置yum源,在此记录下这次配置过程。

第一步:删除旧yum包
rpm -qa |grep yum

rpm -qa|grep yum|xargs rpm -e --nodeps
第二步:查看redhat的版本和位数
uname -a
cat /etc/redhat-release 

第三步:下载最新rpm包
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm


wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-45.el7.x86_64.rpm

第四步:安装
rpm -Uvh rpm-4.11.3-45.el7.x86_64.rpm --nodeps

rpm -Uvh  python-urlgrabber-3.10-10.el7.noarch.rpm --nodeps

rpm -ivh yum-3.4.3-168.el7.centos.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
第五步:修改yum源配置文件

cd /etc/yum.repos.d
 mv redhat.repo redhat.repo.bak 
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo 
vim CentOS6-Base-163.repo 使用全文替换: :1,$s/$releasever/7
第六步:验证

重建缓存yum makecache

yum repolist

yum install gcc gcc-c++ -y

 

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页