当前位置:   article > 正文

RedHat-8.0配置yum仓库(基于CentOS-7源在线安装)_updating subscription management repositories. una

updating subscription management repositories. unable to read consumer ident

01、测试yum仓库是否能正常使用

[root@bogon ~]# yum install vsftpd
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Error: There are no enabled repos.
[root@bogon ~]# 

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

报错:系统未注册。说明该yum仓库功能无法正常使用,而 RedHat自带的仓库又需要付费才能使用,身为技术人,花钱买技术那是不可能的。
解决办法:更换为Centos-7的yum源

02、yum常用命令

yum list (功能描述:列出所有可用的package和package组)
yum clean all (功能描述:清除所有缓冲数据)
yum deplist httpd (功能描述:列出一个包所有依赖的包)
  • 1
  • 2
  • 3

03、前期准备工作

1)确定redhat操作系统可以上网,如果是在虚拟机上安装的系统,可以讲系统的网络诺配置器改成NAT模式,如图所示,只要主机能上网,则虚拟机中的操作系统就可以上网。
在这里插入图片描述
2)下载适合redhat版本的repo文件(本文以CentOS-7为例),下载地址:
repo下载地址
选择要下载的CentOS的repo版本

04、将下载下来的repo拷贝至redhat系统的yum.repos.d文件夹中

[root@bogon ~]#cp /tmp/pkg/Centos-7.repo /etc/yum.repos.d
  • 1

05、查看系统自身安装的yum软件包

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

06、卸载所有自带yum软件包

[root@bogon ~]# rpm -e 软件包名称 --nodeps  #可以使用简称如 rpm -e yum-* --nodeps
  • 1

07、修改04步骤中上传的Centos-7.repo文件内容

07-01、首先备份/etc/yum.repos.d/Centos-7.repo

[root@bogon ~]#mv /etc/yum.repos.d/Centos-8.repo /etc/yum.repos.d/Centos-8.repo.backup
  • 1

07-02、修改Centos-7.repo文件中的内容

查看更改前文件内容:

[root@bogon yum.repos.d]# cat Centos-7.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[root@bogon yum.repos.d]# 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65

更改内容:
1)将无效的网络地址删除掉或者注释(本文中采用删除的方式,将内网地址删除掉)
2)将文中的$releasever 替换成 要采用的redhat系统版本号(本文的为7)
其他版本号可以查看网址:CentOS版本号

[root@bogon ~]# vim /etc/yum.repos.d/Centos-7.repo
  • 1

更改后的Centos-7.repo文件内容:

[root@bogon ~]# cat /etc/yum.repos.d/Centos-7.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-7 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-7 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-7 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[root@bogon ~]# 

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69

08、清除缓存

[root@bogon ~]# yum clean all
-bash: /usr/bin/yum: No such file or directory
  • 1
  • 2

报错:-bash: /usr/bin/yum: No such file or directory 没有文件或者文件夹
解决方法:需要安装yum命令。执行如下命令:

[root@bogon ~]# rpm -ivh --nodeps https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm 
  • 1

结果:
在这里插入图片描述

查看可用 yum repolist all 结果如下:
在这里插入图片描述
yum源可以正常访问。
重新执行命令清除缓存。

09、将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度

[root@bogon ~]# yum makecache
  • 1

10、开始使用yum在线安装软件吧!

(注意:Redhat的注册提示信息仍会出现,但可以正常使用yum功能)
因为镜像网站会存在更新,文件位置可能会发生变化,请在使用过程中根据CentOS-7镜像文件信息镜像源网站里的信息自行调整。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/168821
推荐阅读
相关标签
  

闽ICP备14008679号