使用yum报错:this system is not registered to red hat subscription management;原因:没在红帽订阅
两种解决方案:1、购买正版;2、更换成centos的yum包。
很显然,我拿来玩的,肯定选第二种,下面地址是centos7的yum包
https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
步骤:
1、卸载红帽自带的yum
rpm -e --nodeps yum
2、下载相关yum包,即上面三个
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
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-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
这时出现了一个问题,最小化安装系统没有自带wget工具,报错-bash: wget: command not found
;网上查询教程大多让使用sudo yum install wget
来安装wget,哈哈哈哈,我就是来解决yum用不了的,给我来这一手;这时我们要想到另一个Linux重要的下载命令curl
,下载命令如下
curl -O https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
curl -O https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
curl -O https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
直接安装会报错提示缺少依赖包,可以直接尝试安装;随着版本更新,依赖包也会变化;这里根据提示更新或安装依赖包,下面是我本次需要的:
下载依赖包
curl -O https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/rpm-4.11.3-45.el7.x86_64.rpm
curl -O https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
安装更新rpm
rpm -Uvh rpm-4.11.3-32.el7.x86_64.rpm --nodeps
下面这个是缺少的另一个依赖包,直接更新试了好几次,不行,选择卸载重装
查询现有版本:rpm -q python-urlgrabber
python-urlgrabber-3.10-4.el7.noarch
卸载
rpm -e python-urlgrabber-3.10-4.el7.noarch
安装新版本
rpm -ivh python-urlgrabber-3.10-10.el7.noarch.rpm
3、安装
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh yum-3.4.3-168.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm