参考链接 https://blog.csdn.net/nudtfeizhang/article/details/83689808
https://www.cnblogs.com/djlsunshine/p/10607883.html
为啥不能使用的 主要就是因为redhat自带的需要注册才能使用。通俗讲就是换成centOS系统的yum库 。redHat与centOS的版本是对应的,所以只需要知道redHat的版本下载对应的库就可以了。
关键点:1.要有网
2.如果出现key ID f4a80eb5: NOKEY 的问题 应该就是版本问题 可能太高或太低
备注:其实我util包怎么也没装上 但好像后边也没有影响也能使用;关于python ,如果装了多个版本的python,需要配置指定使用哪个
1、为什么RHEL不能使用yum命令
因为它是收费的,所以系统需要先注册。
2、解决方案:使用centOS系统的yum库
2.1、保证电脑能上网
$ping www.baidu.com
2.2、清除原有RHEL的与yum相关软件包.
$rpm -qa | grep yum | xargs rpm -e --nodeps
$rpm -qa | grep python-urlgrabber|xargs rpm -e --nodeps
2.3、查找与当前系统匹配的centOS系统版本
163的镜像库 (推荐):
http://mirrors.163.com/centos/7/os/x86_64/Packages/
kernel镜像库:
https://mirrors.edge.kernel.org/centos/7/os/x86_64/Packages/
2.4、 下载python相关的rpm包并安装
$wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
$wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
$rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
$rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm
2.5、 下载yum相关的rpm包并安装
此处如果直接用CentOS 7的包的话,会出现以下问题:
$wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-150.el7.centos.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-utils-1.1.31-40.el7.noarch.rpm
$wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-40.el7.noarch.rpm
$wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
$ls
anaconda-ks.cfg yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
initial-setup-ks.cfg yum-updateonboot-1.1.31-40.el7.noarch.rpm
yum-3.4.3-150.el7.centos.noarch.rpm yum-utils-1.1.31-40.el7.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
$rpm -ivh yum-*
warning: yum-3.4.3-150.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
python-urlgrabber >= 3.10-8 is needed by yum-3.4.3-150.el7.centos.noarch
解决方法是:去http://rpm.pbone.net/下载相对较低版本的rpm包。
$wget ftp://ftp.icm.edu.pl/vol/rzm3/linux-centos-vault/7.1.1503/cr/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
$wget ftp://ftp.icm.edu.pl/vol/rzm3/linux-centos-vault/7.1.1503/cr/x86_64/Packages/yum-3.4.3-132.el7.centos.noarch.rpm
$wget ftp://ftp.icm.edu.pl/vol/rzm3/linux-centos-vault/7.3.1611/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
$wget ftp://ftp.icm.edu.pl/vol/rzm3/linux-centos-vault/7.1.1503/cr/x86_64/Packages/yum-updateonboot-1.1.31-34.el7.noarch.rpm
$wget ftp://ftp.icm.edu.pl/vol/rzm3/linux-centos-vault/7.1.1503/cr/x86_64/Packages/yum-utils-1.1.31-34.el7.noarch.rpm
$rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
$rpm -ivh yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm yum-3.4.3-132.el7.centos.noarch.rpm
$rpm -ivh yum-utils-1.1.31-34.el7.noarch.rpm
$rpm -ivh yum-updateonboot-1.1.31-34.el7.noarch.rpm
必须按上面顺序安装这五个包,不然会报包依赖相关的错,而且yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm和yum-3.4.3-132.el7.centos.noarch.rpm必须同时安装。
如果上面下载包的链接失效了,可以到http://rpm.pbone.net/中搜索并使用其他的下载链接:
2.6、 新建repo 配置文件;
$vim /etc/yum.repos.d/CentOS-Base.repo
在改文件中写入如下内容:
#CentOS-Base.repo
[base]
name=CentOS-$7 - Base - 163.com
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$7 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$7 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
[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
2.7、清除缓存:
$yum clean all
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
Cleaning up everything
2.8、测试安装是否正常;
$yum -y install docker
原文链接:https://blog.csdn.net/nudtfeizhang/article/details/83689808