Linux:CentOS 7 安装yum

2022-09-03 13:39:47 浏览数 (1)

大家好,又见面了,我是你们的朋友全栈君。

一:删除原有的yum

1.查看已经安装的yum

代码语言:javascript复制
[root@Server-i-09nwynqbbd ~]# rpm -qa |grep yum
yum-3.4.3-161.el7.centos.noarch
yum-utils-1.1.31-54.el7_8.noarch
yum-plugin-fastestmirror-1.1.31-50.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64

2.删除yum包

代码语言:javascript复制
[root@Server-i-09nwynqbbd ~]# rpm -qa|grep yum|xargs rpm -e --nodeps

3.查看是否删除完毕(未找到yum包则删除完成)

代码语言:javascript复制
[root@Server-i-09nwynqbbd ~]# rpm -qa |grep yum
[root@Server-i-09nwynqbbd ~]# 

二:查看Liunx系统版本

代码语言:javascript复制
[root@Server-i-09nwynqbbd ~]# uname -an
Linux Server-i-09nwynqbbd 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@Server-i-09nwynqbbd ~]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core)

三:下载yum有关的RPM包

代码语言:javascript复制
[root@Server-i-09nwynqbbd ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
[root@Server-i-09nwynqbbd ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
[root@Server-i-09nwynqbbd ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
[root@Server-i-09nwynqbbd ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
[root@Server-i-09nwynqbbd ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

四:安装下载好的yum有关的RPM包

代码语言:javascript复制
[root@Server-i-09nwynqbbd ~]# rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm --force --nodeps
[root@Server-i-09nwynqbbd ~]# rpm -ivh yum-* --force --nodeps
[root@Server-i-09nwynqbbd ~]# rpm -qa |grep yum
yum-3.4.3-168.el7.centos.noarch
yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch
yum-utils-1.1.31-54.el7_8.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64

五:查看是否安装完成

代码语言:javascript复制
[root@Server-i-09nwynqbbd ~]# yum makecache
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile base                  | 3.6 kB  00:00:00     
docker-ce-stable                                                 | 3.5 kB  00:00:00     
epel                                                             | 4.7 kB  00:00:00     
extras                                                           | 2.9 kB  00:00:00     
updates                                                          | 2.9 kB  00:00:00     
(1/9): epel/x86_64/prestodelta                                   | 1.5 kB  00:00:00     
(2/9): docker-ce-stable/7/x86_64/filelists_db                    |  29 kB  00:00:00     
(3/9): docker-ce-stable/7/x86_64/other_db                        | 121 kB  00:00:00     
(4/9): extras/7/x86_64/filelists_db                              | 259 kB  00:00:00     
(5/9): extras/7/x86_64/other_db                                  | 145 kB  00:00:00     
(6/9): updates/7/x86_64/other_db                                 | 829 kB  00:00:00     
(7/9): epel/x86_64/other_db                                      | 3.4 MB  00:00:00     
(8/9): updates/7/x86_64/filelists_db                             | 6.6 MB  00:00:01     
(9/9): epel/x86_64/filelists_db                                  |  12 MB  00:00:02     
元数据缓存已建立
[root@Server-i-09nwynqbbd ~]# 

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/139925.html原文链接:https://javaforall.cn

0 人点赞