redhat7.4 使用centos yum源

 

新安装了redhat7.4安装后,登录系统,使用yum update 更新系统。提示:

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

无法更新。

redhat 默认自带的 yum 源需要注册,才能更新。我们想不花钱也可以更新,需要替换掉redhat的yum源。

 

1.检查是否安装yum包

查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:

[root@bogon ~]# rpm -qa |grep yum
yum-3.4.3-154.el7.noarch
yum-rhn-plugin-2.0.1-9.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64

 

2 删除redhat自带的yum包

卸载上面显示的所有yum包:

[root@bogon ~]# rpm -qa |grep yum | xargs rpm -e --nodeps

再检查

[root@bogon ~]# rpm -qa |grep yum

 

查看,无信息显示表示已经卸载完成。

 

3.下载新的yum包。使用Centos7的yum包

 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm
 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/wget-1.14-15.el7_4.1.x86_64.rpm

 

安装yum软件包

注意:单个的安装包可能会依赖其它包(例如yum和yum-fastestmirror会相互依赖),所以我们可以把所有这些包放在一起,用一行命令将它们同时安装即可:

 

rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm  --replacefiles

rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-3.4.3-158.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm

 

4.更换yum源。使用本地源

[root@bogon ~]# cat /etc/yum.repos.d/client.repo 
[bash]
name=centos7
baseurl=http://192.168.238.128:81
enabled=1
gpgcheck=0
gpgkey=http://192.168.238.128:81/RPM-GPG-KEY-CentOS-7
 
 

第四步:运行yum makecache生成缓存
yum clean all
yum makecache

 

yum安装软件,报错

** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
rhn-check-2.0.2-17.el7.noarch has missing requires of yum-rhn-plugin >= ('0', '1.6.4', '1')

 

解决办法

首先安装 yum-utils 套件
  

yum install yum-utils

执行 clean duplicate package

 

转载于:https://www.cnblogs.com/fengjian2016/p/9491936.html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值