RHEL7.2搭建yum源

我在RHEL7.2搭建本地yum时发现突然报错了。

查看了一下报错信息显示

图片1

加载插件:langpacks,产品ID,搜索禁用回购,订阅管理器该系统未注册到红帽订阅管。你可以使用subscription-m急于注册.repolist:0由于Redhat的yum在线更新是收费的,如果没有注册的话是不能使用的,即不能在线安装软件。

我只好用CentOS的yum来替换掉

1.先检查一下yum的RPM包组

图片2

在用RPM依次强制删除

rpm -e yum-rhn-plugin-2.0.1-5.el7.noarch –nodeps

rpm -e yum-3.4.3-132.el7.noarch –nodeps

rpm -e yum-utils-1.1.31-34.el7.noarch –nodeps

rpm -e yum-langpacks-0.4.2-4.el7.noarch –nodeps

warning: /etc/yum/pluginconf.d/langpacks.conf saved as /etc/yum/pluginconf.d/langpacks.conf.

rpmsave(忽略这条信息)

rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 –nodeps

rpm -e PackageKit-yum-1.0.7-5.el7.x86_64 –nodeps

在检查一下yum包组

图片3

用centos相关包组替换掉RHEL的yum(下载时有可能包组更新,后缀不一样导致下载失败,解决方法:用浏览器进入下载路径手动下载,如果有centos7.2的ISO可以解压后再Packages下找到这些包,um-rhn-plugin-2.0.1-9.el7.noarch.rpm这个包要在rhel下找)

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-rhn-plugin-2.0.1-9.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-42.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-langpacks-0.4.2-7.el7.noarch.rpm

RPM执行安装安装yum(按照以下顺序)

rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 依赖于yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm

图片4

下载该安装包并且与yum-3.4.3-132.el7.centos.0.1.noarch.rpm一起安装

rpm -ivh yum-3.4.3-132.el7.centos.0.1.noarch.rpm yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm

rpm -ivh yum-rhn-plugin-2.0.1-5.el7.noarch.rpm(忽略警告)

rpm -ivh yum-utils-1.1.31-34.el7.noarch.rpm(忽略警告)

rpm -ivh yum-langpacks-0.4.2-4.el7.noarch.rpm(忽略警告)

rpm -ivh PackageKit-yum-1.0.7-5.el7.centos.x86_64.rpm(忽略警告)

有依赖关系下载PackageKit-glib-1.0.7-5.el7.centos.x86_64.rpm(忽略警告)

rpm -ivh PackageKit-glib-1.0.7-5.el7.centos.x86_64.rpm(忽略警告)

rpm -ivh PackageKit-1.0.7-5.el7.centos.x86_64.rpm(忽略警告)

rpm -i –force –nodeps PackageKit-1.0.7-5.el7.centos.x86_64.rpm(忽略警告)

rpm -ivh PackageKit-yum-1.0.7-5.el7.centos.x86_64.rpm(忽略警告)

新建一个网络yum源

vim /etc/yum.repos.d/CentOS-Base.repo

[base]

name=CentOS-$releasever – Base – 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

baseurl=http://mirrors.163.com/centos/7/os/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

 

#released updates

[updates]

name=CentOS-$releasever – Updates – 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

baseurl=http://mirrors.163.com/centos/7/updates/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

 

#additional packages that may be useful

[extras]

name=CentOS-$releasever – Extras – 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

baseurl=http://mirrors.163.com/centos/7/extras/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

 

#additional packages that extendfunctionality of existing packages

[centosplus]

name=CentOS-$releasever – Plus – 163.com

baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

 

测试一下并且修正错误

yum install vim

yum update

解决之前遗留问题

rpm -e PackageKit-1.0.7-5.el7.centos.x86_64 –nodeps

yum install PackageKit-1.0.7-5.el7.centos.x86_64.rpm

在用yum update不会报错,安装完毕

 

 

 

 

本文参考https://blog.csdn.net/x6_9x/article/details/50613045

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/96567

发表评论

登录后才能评论

This site uses Akismet to reduce spam. Learn how your comment data is processed.

联系我们

400-080-6560

在线咨询:点击这里给我发消息

邮件:1823388528@qq.com

工作时间:周一至周五,9:30-18:30,节假日同时也值班