Linux 之 yum使用(yum 命令使用讲解)

yum使用

1.yum安装软件

yum -y install vim

[root@localhost ~]# yum -y install vim
已加载插件:fastestmirror
Bad id for repo: mirrors.aliyun.com_docker-ce_linux_centos_docker-ce.xn--repo()-mu8ig98h4l0hokj, byte = ( 60
Loading mirror speeds from cached hostfile
 * epel: mirror.nyist.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 vim-enhanced.x86_64.2.7.4.629-8.el7_9 将被 安装
--> 解决依赖关系完成

依赖关系解决

====================================================================================================================================================================================
 Package                                     架构                                  版本                                                源                                      大小
====================================================================================================================================================================================
正在安装:
 vim-enhanced                                x86_64                                2:7.4.629-8.el7_9                                   updates                                1.1 M

事务概要
====================================================================================================================================================================================
安装  1 软件包

总下载量:1.1 M
安装大小:2.2 M
Downloading packages:
vim-enhanced-7.4.629-8.el7_9.x86_64.rpm                                                                                                                      | 1.1 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : 2:vim-enhanced-7.4.629-8.el7_9.x86_64                                                                                                                           1/1
  验证中      : 2:vim-enhanced-7.4.629-8.el7_9.x86_64                                                                                                                           1/1

已安装:
  vim-enhanced.x86_64 2:7.4.629-8.el7_9

完毕!

2.yum显示安装包信息

# yum list显示所有已经安装和可以安装的程序包
yum list 

# 根据关键字查找安装包,如我这里的 vim
yum search vim

# 查看命令是由哪个包提供的,如我这里的 vim 命令
 yum provides vim
 

yum search vim 命令执行结果:

[root@localhost ~]# yum search vim
已加载插件:fastestmirror
Bad id for repo: mirrors.aliyun.com_docker-ce_linux_centos_docker-ce.xn--repo()-mu8ig98h4l0hokj, byte = ( 60
Loading mirror speeds from cached hostfile
 * epel: mirrors.bfsu.edu.cn
====================================================================== N/S matched: vim =======================================================================
beakerlib-vim-syntax.noarch : Files for syntax highlighting BeakerLib tests in VIM editor
boxes-vim.noarch : Vim plugin for boxes
fluxbox-vim-syntax.noarch : Fluxbox syntax scripts for vim
geany-plugins-vimode.x86_64 : Vim-mode plugin for Geany
neovim.x86_64 : Vim-fork focused on extensibility and agility
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
python2-neovim.noarch : Python client to Neovim
python36-neovim.noarch : Python client to Neovim
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-ansible.noarch : Vim plugin for syntax highlighting ansible's common filetypes
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-fugitive-gitlab.noarch : GitLab support for vim-fugitive plugin
vim-go.x86_64 : Go development plugin for Vim
vim-gtk-syntax.noarch : Vim syntax highlighting for GLib, Gtk+, Gstreamer, and more
vim-jellybeans.noarch : A colorful, dark color scheme for Vim
vim-minimal.x86_64 : A minimal version of the VIM editor
vim-toml.noarch : Vim syntax for TOML
vim-vimoutliner.noarch : Script for building an outline editor on top of Vim
xtuple-csvimp-devel.x86_64 : CSVImp development files
apvlv.x86_64 : PDF viewer which behaves like Vim
vim-fugitive.noarch : A Git wrapper so awesome, it should be illegal
vim-halibut.noarch : Syntax file for the halibut manual tool
vim-trailing-whitespace.noarch : Highlights trailing whitespace in red and provides :FixWhitespace to fix it
xtuple-csvimp.x86_64 : xTuple data import utility

  名称和简介匹配 only,使用“search all”试试。

yum provides vim 命令执行结果:

[root@localhost ~]# yum provides vim
已加载插件:fastestmirror
Bad id for repo: mirrors.aliyun.com_docker-ce_linux_centos_docker-ce.xn--repo()-mu8ig98h4l0hokj, byte = ( 60
Loading mirror speeds from cached hostfile
 * epel: mirrors.tuna.tsinghua.edu.cn
2:vim-enhanced-7.4.629-7.el7.x86_64 : A version of the VIM editor which includes recent enhancements
源    :base
匹配来源:
提供    :vim = 7.4.629-7.el7



2:vim-enhanced-7.4.629-8.el7_9.x86_64 : A version of the VIM editor which includes recent enhancements
源    :updates
匹配来源:
提供    :vim = 7.4.629-8.el7_9



2:vim-enhanced-7.4.629-8.el7_9.x86_64 : A version of the VIM editor which includes recent enhancements
源    :@updates
匹配来源:
提供    :vim = 7.4.629-8.el7_9

3.yum清缓存

缓存文件截图:
在这里插入图片描述

# 清除缓存目录下的软件包,清空的是(/var/cache/yum)下的缓存
yum clean packages

# 清除缓存目录下的 headers
yum clean headers

# 清除缓存目录下旧的 headers
yum clean oldheaders 		

# 清除所有缓存目录
yum clean all

4.卸载安装

yum remove vim

[root@localhost ~]# yum remove vim
已加载插件:fastestmirror
Bad id for repo: mirrors.aliyun.com_docker-ce_linux_centos_docker-ce.xn--repo()-mu8ig98h4l0hokj, byte = ( 60
正在解决依赖关系
--> 正在检查事务
---> 软件包 vim-enhanced.x86_64.2.7.4.629-8.el7_9 将被 删除
--> 解决依赖关系完成

依赖关系解决

====================================================================================================================================================================================
 Package                                     架构                                  版本                                               源                                       大小
====================================================================================================================================================================================
正在删除:
 vim-enhanced                                x86_64                                2:7.4.629-8.el7_9                                  @updates                                2.2 M

事务概要
====================================================================================================================================================================================
移除  1 软件包

安装大小:2.2 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在删除    : 2:vim-enhanced-7.4.629-8.el7_9.x86_64                                                                                                                           1/1
  验证中      : 2:vim-enhanced-7.4.629-8.el7_9.x86_64                                                                                                                           1/1

删除:
  vim-enhanced.x86_64 2:7.4.629-8.el7_9

完毕!


猜你喜欢

转载自blog.csdn.net/p309654858/article/details/132487762