红帽8更换自带的yum源
18
2023-10-13
安装几个月后的红帽8在使用yum安装服务时,提示This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
查了以下说是使用redhat的yum源是需要注册付费的。
所以此时我们需要更换yum源,把redhat自带的源更换成国内的镜像源,类似阿里源、清华源、网易源等
(此处我们使用阿里源进行替换)
一、首先查询并删除redhat自带的yum源
rpm -qa|grep yum##查看红帽自带的yum源
[root@localhost yum.repos.d]# rpm -qa|grep yum
yum-4.0.9.2-5.el8.noarch
[root@localhost yum.repos.d]# rpm -qa|grep yum|xargs rpm -e --nodeps##使用命令直接删除
二、找到阿里镜像源网站并下载对应的rpm包,并安装。
1、wget https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/Packages/yum-4.7.0-4.el8.noarch.rpm
wget https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/Packages/yum-utils-4.0.21-3.el8.noarch.rpm
2、rpm -ivh yum-utils-4.0.21-3.el8.noarch.rpm yum-4.7.0-4.el8.noarch.rpm##一起安装
[root@localhost yum.repos.d]# rpm -ivh yum-4.7.0-4.el8.noarch.rpm yum-utils-4.0.21-3.el8.noarch.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:yum-utils-4.0.21-3.el8 ################################# [ 50%]
2:yum-4.7.0-4.el8 ################################# [100%]
ps:若遇见执行rpm -ivh提示error: Failed dependencies时,需要在rpm -ivh 包名 --nodeps --force(不检查,强制安装)
三、在阿里源中下载对应的repo包,并替换repo文件中相应字段,最后完成换源
1、wget -P /etc/yum.repos.d/ https://mirrors.aliyun.com/repo/Centos-8.repo ##使用wget将repo包下载到对应目录中
2、替换文件中的$releasever为版本号7,修改刚下载的文件。因为我的版本是8,如果你的版本不是8,那就替换成你的版本号。
vim /etc/yum.repos.d/CentOS-Base.repo
在vim中敲击 :输入:
:%s/$releasever/8/ge
3、yum clean all && yum makecache ##清除yum缓存,然后新建缓存
4、[root@localhost tmp]# yum info -y nfs-utils.x86_64
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.##还是会提醒需要付费,但是已经能够正常使用yum源了
Last metadata expiration check: 0:44:31 ago on Fri 13 Oct 2023 04:44:01 PM CST.
Installed Packages
Name : nfs-utils
Epoch : 1
Version : 2.3.3
Release : 14.el8
Arch : x86_64
Size : 1.4 M
Source : nfs-utils-2.3.3-14.el8.src.rpm
Repo : @System
From repo : anaconda
Summary : NFS utilities and supporting clients and daemons for the kernel NFS server
URL : http://linux-nfs.org/
License : MIT and GPLv2 and GPLv2+ and BSD
Description : The nfs-utils package provides a daemon for the kernel NFS server and
: related tools, which provides a much higher level of performance than the
: traditional Linux NFS server used by most users.
:
: This package also contains the showmount program. Showmount queries the
: mount daemon on a remote host for information about the NFS (Network File
: System) server on the remote host. For example, showmount can display the
: clients which are mounted on that host.
:
: This package also contains the mount.nfs and umount.nfs program.
- 7
- 0
-
分享