linux下YUM工具的使用:yum安装/升级/查看/搜索/卸载软件包 一.关于软件包 二.关于YUM 三.yum工具的使用

linux下YUM工具的使用:yum安装/升级/查看/搜索/卸载软件包
一.关于软件包
二.关于YUM
三.yum工具的使用

在linux中安装软件是需要安装包的,软件的安装包有各种类型:.zip,.rar,.rpm,.tar.gz,.tar。软件包还可以分为源代码包和二进制

包,源代码包是没有经过编译的包,需要经过GCC、C++编译器环境编译才能运行。二进制包无需编译,可以直接安装使用。区分是否为

源代码包还是二进制包还得基于软件包里面的文件来判断,包含.h、.c、.cpp、.cc等结尾的源码文件,称之为源代码包,而软件包里面存

在bin目录(bin目录里有可执行文件),称之为二进制包。源码包高度可定制,可以*选择自己需要的功能。

二.关于YUM

​ yum(全称为 Yellow dog Updater, Modified)是一个前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并

且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载、安装。yum提供了查找、安装、删除某一

个、一组甚至全部软件包的命令,而且命令简洁而又好记。yum是基于C/S的架构,C=client,S=ftp/http/file。

三.yum工具的使用

3.1 yum安装软件功能

#安装软件包,-y直接安装
[root@node5 ~]# yum -y install telnet

3.2 yum升级软件包功能

[root@node5 ~]# yum -y update    #升级软件包,改变软件设置和系统设置,系统版本内核都升级,不加任何包,表示整个系统进行升级
[root@node5 ~]# yum -y upgrade   #升级软件包,不改变软件设置和系统设置,系统版本升级,内核不改变

3.3 yum查看,搜索功能

#查询rpm包telnet作用
[root@node5 ~]# yum info telnet
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Installed Packages
Name        : telnet
Arch        : x86_64
Epoch       : 1
Version     : 0.17
Release     : 65.el7_8
Size        : 113 k
Repo        : installed
From repo   : updates
Summary     : The client program for the Telnet remote login protocol
URL         : http://web.archive.org/web/20070819111735/www.hcs.harvard.edu/~dholland/computers/old-netkit.html
License     : BSD
Description : Telnet is a popular protocol for logging into remote systems over the
            : Internet. The package provides a command line Telnet client

#查看命令是哪个软件包安装的
[root@node5 ~]# yum provides /usr/bin/find
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
1:findutils-4.5.11-6.el7.x86_64 : The GNU versions of find utilities (find and xargs)
Repo        : base
Matched from:
Filename    : /usr/bin/find



1:findutils-4.5.11-5.el7.x86_64 : The GNU versions of find utilities (find and xargs)
Repo        : @anaconda
Matched from:
Filename    : /usr/bin/find

#按关键字搜索软件包
[root@node5 ~]# yum search extundelet
============================================================================================ N/S matched: extundelet ============================================================================================
extundelete.x86_64 : An ext3 and ext4 file system undeletion utility

  Name and summary matches only, use "search all" for everything.

3.4 yum卸载功能

#卸载telnet
[root@node5 ~]# yum -y remove telnet                                                              

总结:如果yum报错,需要注意的几个小问题:

  • ​ 确定光盘是否连接,光盘是否挂载
  • ​ 配置文件中格式是否正确,字母,符号有没有少写,挂载点和配置文件中设置的是否一致
  • ​ 网络源需要联网,操作和RPM类似,并且会自动安装依赖项

3.5 yum安装软件包组功能

1.安装软件包组语法:yum groupinstall GROUPNAME

#查看有哪些软件包组
[root@node5 ~]# yum grouplist

#安装软件包组
[root@node5 ~]# yum groupinstall 'Compatibility Libraries' -y