关于linux下安装yum(安装失败遇到的坑)

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
没有已启用的源。
执行 “yum repolist all” 查看您拥有的源。
您可以用 yum-config-manager --enable <源名> 来启用源
1.检查是否安装yum包。查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:

  1. #rpm -qa |grep yum

2 删除redhat自带的yum包

  1. #rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)
  2. #rpm -qa |grep yum (查询确认)

3、 去http://mirrors.163.com/centos/7/os/x86_64/Packages/下载如下文件
下载:

  1. yum-3.4.3-163.el7.centos.noarch.rpm
  2. yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
  3. yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
  4. python-inotify-0.9.4-4.el7.noarch.rpm

4、创建yumFile文件夹

  1. mkdir yumFile

5、将下载的4个文件上传至yumFile文件夹下

  1. rpm -ivh python-inotify-0.9.4-4.el7.noarch.rpm
  2. rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
  3. rpm -ivh yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
  4. rpm -ivh yum-3.4.3-163.el7.centos.noarch.rpm

6、安装是出现以下错误:

root@jxw-xmsb-web1 yumFile]# rpm -ivh yum-3.4.3-163.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
警告:yum-3.4.3-163.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
错误:依赖检测失败:
python-urlgrabber >= 3.10-8 被 yum-3.4.3-163.el7.centos.noarch 需要
rpm >= 0:4.11.3-22 被 yum-3.4.3-163.el7.centos.noarch 需要

7、则运行:

  1. rpm -ivh yum-3.4.3-163.el7.centos.noarch.rpm --force --nodeps yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

8、修改来源文件

(1)进入到系统yum源的目录下:

  1. #cd /etc/yum.repos.d

(2)下载yum源:
进入:http://mirrors.163.com/.help/centos.html里面有下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)

(3)修改CentOS6-Base-163.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=KaTeX parse error: Expected 'EOF', got '&' at position 11: releasever&̲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=KaTeX parse error: Expected 'EOF', got '&' at position 11: releasever&̲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=KaTeX parse error: Expected 'EOF', got '&' at position 11: releasever&̲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
9、这其中会有一个巨坑,如果是从网站上下载下来的CentOS7-Base-163.repo,一定要记得将文件中的信息替换上面我的。还有一种错误困扰了我几个小时,就是在/etc/yum.repos.d路径下,除了有CentOS7-Base-163.repo文件和CentOS-Base.repo文件其余文件一律删除,就OK了。
10、运行makecache 生成缓存

  1. yum makecache

11、运行yum clean all(等同于 yum cleanheaders ; yum cleanpackages);

  1. yum clean all

12、更新YUM文件

  1. yum update

13、是否安装成功
yum install dhcp -y
提示安装,就说明可以了。
以上文章参考了https://www.cnblogs.com/chenyuanbo/p/11637016.html的文章,并在其中加入了自己遇到坑,与如何解决的。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值