关于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包:
#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
rpm -ivh yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
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、则运行:
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文件
#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 生成缓存
yum makecache
11、运行yum clean all(等同于 yum cleanheaders ; yum cleanpackages);
yum clean all
12、更新YUM文件
yum update
13、是否安装成功
yum install dhcp -y
提示安装,就说明可以了。
以上文章参考了https://www.cnblogs.com/chenyuanbo/p/11637016.html的文章,并在其中加入了自己遇到坑,与如何解决的。
————————————————
版权声明:本文为CSDN博主「莀逸」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_42390329/article/details/107733749