问题描述

使用yum进行安装软件的时候报错

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.

yum 是一个软件安装管理的机制,通常情况下安装软件需要连接到网络上,从网络上的软件库进行软件的下载及安装,但是 RHEL 系统只有注册的用户才能用 yum 机制进行线上安装,可以直接将将 RHEL7 的 yum 源换成 Centos7 的。就可以进行安装了。

解决步骤

0,进入/opt目录,进入root模式,新建yum目录

1,查看自己redhat版本

cat /etc/redhat-release


要是版本一致后续的操作与博主一致,不一致的需要自行进行略微的改动。

2,查看redhat 7.0系统本身所安装的那些yum 软件包并将其一一删除

查看已经安装的软件包

rpm -qa | grep yum


删除
将黑体换为以上安装的软件包,将其意义删除
rpm -e yum-rhn-plugin-2.0.1-10.el7.noarch –nodeps
也可以使用如下命令,将其一次删除完
rpm -e PackageKit-yum-1.1.10-2.el7.x86_64 yum-3.4.3-167.el7.noarch –nodeps

可重新查看,检查是否已经去全部删除,确保已经完全删除

3,确定自己的虚拟机可以上网

ping www.baidu.com


使用Ctrl+C可以终止访问

4,找到自己系统所对应的文件包版本更新

下载的网站为 http://mirrors.163.com/

进入找到你自己版本的对应文件,注意下载的需要与你上面删除的一致。CentOS几乎和RedHat是一样的,所以无需担心软件包是否可安装。

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/PackageKit-yum-1.1.10-2.el7.centos.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-langpacks-0.4.2-7.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-rhn-plugin-2.0.1-10.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm

5,查看已经下载的文件

6,安装软件包

rpm -ivh *.rpm --force --nodeps

7,新建repo 配置文件

新建一个终端,进入超级用户模式,进入目录cd /etc/yum.repos.d/
编辑文件gedit CentOS-Base.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-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&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-$7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&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-$7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&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 extend functionality of existing packages
[centosplus]
name=CentOS-$7 - 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

保存退出

8,清除缓存

yum clean all

9,尝试安装Gvim,测试可以正常使用

使用如下yum -y install gvim

安装等待,完成时候会出现Complete!

打开一个终端,输入gvim键入:q退出

10,删除下载的安装包与yum目录

参考博文

RedHat Linux 7安装CentOS 7 yum源
rpm安装软件时提示warning: *.rpm: Header V3 RSA/SHA256 Signature, keykey ID c105b9de: