码迷,mamicode.com
首页 > 系统相关 > 详细

Linux环境下安装yum

时间:2019-10-08 18:37:11      阅读:4397      评论:0      收藏:0      [点我收藏+]

标签:cti   centos   lin   xargs   parse   出现   pos   mirror   微软雅黑   

 若出现以下错误则代表需要重新安装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包:

 #rpm -qa |grep yum

2 删除redhat自带的yum

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

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

    下载:

yum-3.4.3-163.el7.centos.noarch.rpm

 yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

 python-inotify-0.9.4-4.el7.noarch.rpm

4、创建yumFile文件夹

mkdir yumFile

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

rpm -ivh python-inotify-0.9.4-4.el7.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

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

[email protected] 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、则运行:

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源的目录下:

  #cd  /etc/yum.repos.d

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

3)修改CentOS6-Base-163.repo文件

vi CentOS6-Base-163.repo

 

  

# 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=$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=$releasever&arch=$basearch&repo=updates
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 may be useful
[extras]
name=CentOS-7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$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
"CentOS7-Base-163.repo" 41L, 1491C                                     

9、导入key

rpm --import  RPM-GPG-KEY-CentOS-7

10、运行makecache 生成缓存

yum makecache  

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

yum clean all

12、更新YUM文件

yum  update 

13、是否安装成功
yum  install   dhcp   -y  
提示安装,就说明可以了。

以上内容参考了博主:https://blog.csdn.net/chensongmol/article/details/84797453的文章,本人写这篇博客主要为了便于后期自己进行查看

 

Linux环境下安装yum

标签:cti   centos   lin   xargs   parse   出现   pos   mirror   微软雅黑   

原文地址:https://www.cnblogs.com/chenyuanbo/p/11637016.html

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有 京ICP备13008772号-2
迷上了代码!