yum总结之概述篇

前言

一个linux菜鸟往往因为对与linux安装软件的复杂而望而却步,特别是从windows到linux的用户肯定表示接受不了。确实linux下装软件想做到win下下一步下一步完成目前来说是不可能的。

linux下软件安装有3种方法:   一种是源码安装,需要用户自己手动编译,另一种是RPM包(RedHat Linux Packet Manager),通过RPM命令就可以实现安装。还有一种为*.bin文件。

现在我们就来说一下rpm包:rpm是RedHat Linux Packet Manager的缩写。RPM 是以一种数据库记录的方式来将您所需要的套件安装到您的Linux
主机的一套管理程序。也就是说,您的linux系统中存在着一个关于RPM的数据库,它记录了安装的包以及包与包之间依赖相关性。RPM包是预先在linux机器上编译好并打包好的文件,安装起来非常快捷。但是也有一些缺点,比如安装的环境必须与编译时的环境一致或者相当;包与包之间存在着相互依赖的情况;简而言之就是用rpm安装文件往往存在依赖关系。几个例子要安装a软件依赖b包(系统没有),b包又依赖c包(系统没有)。。。。依赖解决起来非常麻烦,这也在很长时间内成了一个世界难题。、

这时yum工具出现了。

  1. what is 这是什么?

    1、首先在shell中键入如下命令

    [root@desperadochn ~]# man yum

    从返回结果可知:
     NAME
        yum – Yellowdog Updater Modified

       yum是Yellowdog Updater Modified的缩写,其意是黄狗升级工具的意思。

二、why 为什么使用它?

    DESCRIPTION
       yum is an interactive, rpm based, package manager. It can automatically
       perform system updates, including dependency analysis and obsolete pro‐
       cessing  based  on "repository" metadata. It can also perform installa‐
       tion of new packages, removal of old packages and  perform  queries  on
       the  installed and/or available packages among many other commands/ser‐
       vices (see below). yum is similar to other high level package  managers
       like apt-get and smart.

从yum命令的man手册中可知:yum是一个交互式的,基于rpm的包管理器。它可以自动的执行系统升级,包括依赖分析和基于软件仓库的元数据分析。它同样可以用来执行新包的安装,移除旧包,查询已经安装的包/许多其他命令之间可用的包/服务(见下文)。yum就好像其他相似的高级包管理工具一样,如apt-get和smart

总而言之yum是一个高级的包管理工具,他可以安装、更新、删除、显示软件包和软件包组。yum可以自动进行系统更新,基于软件仓库的元数据分析,解决软件包依赖关系。

三、when 何时使用?

1、当你需要安装某些软件却无法解决依赖关系时

2、当你的shell当中缺少默写命令时

3、当你想删除某个包时又被依赖关系搞得头大时

4、当你想更新某个包时。

5、当你缺少某个工具时却又不知道安装那个包时

。。。。。。。。。。。。。。。。。等等,请试试yum工具

四、where 在哪里使用(环境)

 1、redhat系列的linux发行版

2、系统已联网

3、配置可用的yum源

五、who 谁会用

1、系统管理员

2、想要安装软件却不想因为软件依赖浪费时间的人、缺少命令或工具又不知从何下手的人。

3、yum软件节省了许多在软件安装上的大量不必要时间,是运维人员必须熟练掌握的技能。

六、how 如何实现,如何使用

  

  1.  检查yum工具是否安装

    [root@desperadochn ~]# rpm -qa |grep yum
     yum-plugin-fastestmirror-1.1.31-34.el7.noarch
     yum-metadata-parser-1.1.4-10.el7.x86_64
     yum-3.4.3-132.el7.centos.0.1.noarch

若出现类似输出表示yum已经安装成功,若没有任何提示,表示系统还没安装yum工具,yum安装包可以在centos系统光盘中找到,执行如下指令进行安装:

   [root@desperadochn ~]# rpm -ivh yum-*.noarch.rpm

     安装yum需要python-elementtree,python-sqlite,urlgrabber,yumconf等软件包的支持,这些软件包均在centos光盘中可以找到,若出现依赖性问题逐次安装即可。

 

II、yum配置文件详解

 

  1.  yum 的配置文件有主文件/etc/yum.conf和源配置文件/etc/yum.repos.d

  2. Yum的配置一般有两种方式,一种是直接配置/etc/yum.conf文件,另外一种是在/etc/yum.repos.d目录下增加repo文件的方式配置yum源

  3. /etc/yum.conf文件详解

  

以下是etc/yum.conf文件的部分默认内容:

[main]
cachedir=/var/cache/yum/$basearch/$releasever #yum下载RPM包时的缓存目录
keepcache=0     #缓存是否需要保存 1表示保存 0表示不保存
debuglevel=2   #调试级别 默认为2
logfile=/var/log/yum.log #定义yum默认日志文件名称
exactarch=1 #是否只升级与和安装软件包的cpu体系一致的包
obsoletes=1 #是否允许更新陈旧的RPM包 1为允许,2为不允许
gpgcheck=1 #是否执行GPG签名检查,1表示执行,0表示不执行(注1)
plugins=1  #是否允许使用插件 1允许 0不允许
installonly_limit=5  #允许保留多少个内核包

4、/etc/yum.repos.d/ CentOS-Sources.repo文件详解

  repo文件是linux系统中yum源(软件仓库)的配置文件。一般repo文件定义了一个或者多个软件仓库的细节内容,如从哪里下载需要安装或者升级的RPM包,该文件中的设置内容将被yum读取和应用。

用以下命令查看/etc/yum.repos.d/目录是,有如下发现:

 [root@desperadochn ~]# ls /etc/yum.repos.d/
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo

 

以下是/etc/yum.repos.d/CentOS-Sources.repo 文件中的部分默认内容:

[base-source] #方括号里面的是软件源的名称,会被yum识别
name=CentOS-$releasever - Base Sources
#这里定义了软件仓库的名称,通常是为了方便阅读配置文件,$ releasever变量定义了发行版本。
baseurl=http://vault.centos.org/centos/$releasever/os/Source/
#指定RPM软件包来源,支持的协议有http://  ftp://  file://(本地源)
gpgcheck=1  #是否执行GPG签名检查,1表示执行,0表示不执行
enabled=0   #表示软件仓库定义的源是否启用 0表示禁用 1表示启用
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#定义用于校验的GPG秘钥

iii、yum命令使用方法:

 

1、命令格式    
    yum [选项] [命令]

命令中各选项表示的含义如表显示:

选项

选项含义

-y

所有交互式提问都选yes

-q

安静模式操作

–version

显示yum版本

-v

显示详细信息

-x<软件包>

排除软件包

–noplugins

禁用yum插件

–nogpgcheck

禁用GPG签名检查

–installroot=<路径>

设置安装根目录路径

-c

指定配置文件的位置,可以是http、ftp的url 也可以是本地的文件路径

-C

从当地的缓冲区中运行。如非必要不会更新或下载头文件

-d [num]

指定调试级别为设定的数字num,这些通常在0-10之间,用来指定输出多少调试信息,配置参数是debuglevel

–disableplugin=plugin

禁用指定插件

–disablerepo=repoid

禁止一个通过id或者glob指定的软件库。配置选项为enabled

-e[num]

错误级别设置为数字num,这里的num通常是0-10之间的数字,0时只输出临界错误。1时输出使用错误

–enablerepo=repoid

启用一个通过id或者glob指定的软件库。配置选项为enabled

-h [command],–help [command]

显示该命令的帮助信息并退出。

-R [minutes]

设置命令等待的最长时间

yum命令的命令部分描述如下表:

install <软件包名>

安装指定的软件包 *

groupinstall <软件包组名>

安装指定的软件包组   *

reinstall <软件包名>

重新安装软件包  *

localinstall <软件包名>

安装本地软件包  *

search <软件包名>

搜索软件包   *

list

列出目前yum所管理的所有的软件包名称与版本 *

list <软件包名>

在清单中搜索软件包 *

list installed

列出系统中已安装的软件包 *

list installed <正则表达式>

用正则表达式列出系统中已安装的软件包

list extras

列出所有已安装但不在yum仓库中的软件包

list extras <正则表达式>

用正则表达式匹配已安装但不在yum仓库中的软件包

list updates

列出所有可更新的软件包

list updates<正则表达式>

用正则表达式匹配可更新的软件包

list available

列出软件仓库中可以用于安装的软件包

list available<正则表达式>

用正则表达式匹配仓库中可以用于安装的软件包

list recent

列出最近被添加到软件仓库中的软件包

grouplist

列出目前所有已安装和可以使用未安装的软件包组

info

列出目前yum所管理的所有软件的名称、版本和详细信息

info <软件包名>

列出目前指定的软件的名称、版本和详细信息

Info installed

列出所有已安装的软件包与详细信息

Info extras

列出所有已安装但不在yum软件仓库内的软件包

Info updates

列出所有可更新的软件包信息。

groupinfo <软件包组名>

列出该软件包组详细信息

provides 或 whatprovides <软件包名>或<命令>

列出软件包提供那些文件或那些命令有何种软件包提供 *

deplist <软件包名>

查看指定软件包的依赖情况

update

全部更新

update <软件包名>

更新指定的软件包 *

check-update

检查可更新的软件包   *

upgrade <软件包名>

升级指定的软件包 *

groupupdate <软件包组名>

升级指定的软件包组   *

updateinfo

显示软件仓库更新信息

localupdate <软件包名>

本地更新软件包

remove <软件包名>

删除指定软件包

erase  <软件包名>

从系统中删除一个或多个软件包

groupremove <软件包组名>

删除软件包组

clean packages

清除缓存目录下的软件包

clean headers

清除缓存目录下的软件包

clean

清除缓存数据

clean all

清除缓存目录下的软件包及旧的头文件

version

显示机器或可用仓库的版本

help

显示yum命令帮助信息

shell

运行交互式的yum shell  *

history

显示yum使用历史    *

Load-transaction

从文件名加载保存的设置

makecache

生成源数据缓存

repolist

显示配置的软件仓库

resolvedep

确定那个软件包提供了给定的依赖

distribution-synchronization

同步安装软件包到最新版本

 

iv、实例

  0、至关重要的的实例-当你缺少某些命令时不知道是何种rpm提供的?其解决方法如下

[root@desperadochn ~]# yum whatprovides wc
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
extras/7/x86_64/filelists_db                                                                                                                                                                                          | 258 kB  00:00:04
coreutils-8.22-15.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
源    :base
匹配来源:
文件名    :/usr/bin/wc



coreutils-8.22-15.el7_2.1.x86_64 : A set of basic GNU tools commonly used in shell scripts
源    :updates
匹配来源:
文件名    :/usr/bin/wc



coreutils-8.22-15.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
源    :@anaconda
匹配来源:
文件名    :/usr/bin/wc

顺藤摸瓜:

[root@desperadochn ~]# yum install coreutils-8.22-15.el7_2.1.x86_64
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 coreutils.x86_64.0.8.22-15.el7 将被 升级
---> 软件包 coreutils.x86_64.0.8.22-15.el7_2.1 将被 更新
--> 解决依赖关系完成

依赖关系解决

==========================================================================================================================================================================
 Package                                                  架构                                                                                                           源                                                      大小
==========================================================================================================================================================================
正在更新:
 coreutils                                                x86_64                                                
事务概要
===========================================================================================================================================================================
升级  1 软件包

总下载量:3.2 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
coreutils-8.22-15.el7_2.1.x86_64.rpm                                                                                                                                                                                  | 3.2 MB  00:00:23
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : coreutils-8.22-15.el7_2.1.x86_64                                                                                                                                                                                         1/2
  清理        : coreutils-8.22-15.el7.x86_64                                                                                                                                                                                             2/2
  验证中      : coreutils-8.22-15.el7_2.1.x86_64                                                                                                                                                                                         1/2
  验证中      : coreutils-8.22-15.el7.x86_64                                                                                                                                                                                             2/2

更新完毕:
  coreutils.x86_64 0:8.22-15.el7_2.1

完毕!

测试:

 cat /etc/passwd |wc -l
22

1、列出所有可用的包(考虑到到篇幅问题只列出头50个)

[root@desperadochn ~]# yum list |head -n 50
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
已安装的软件包
NetworkManager.x86_64                      1:1.0.6-27.el7              @anaconda
NetworkManager-libnm.x86_64                1:1.0.6-27.el7              @anaconda
NetworkManager-team.x86_64                 1:1.0.6-27.el7              @anaconda
NetworkManager-tui.x86_64                  1:1.0.6-27.el7              @anaconda
acl.x86_64                                 2.2.51-12.el7               @anaconda
aic94xx-firmware.noarch                    30-6.el7                    @anaconda
alsa-firmware.noarch                       1.0.28-2.el7                @anaconda
alsa-lib.x86_64                            1.0.28-2.el7                @anaconda
alsa-tools-firmware.x86_64                 1.0.28-2.el7                @anaconda
audit.x86_64                               2.4.1-5.el7                 @anaconda
audit-libs.x86_64                          2.4.1-5.el7                 @anaconda
authconfig.x86_64                          6.2.8-10.el7                @anaconda
avahi-autoipd.x86_64                       0.6.31-15.el7               @anaconda
avahi-libs.x86_64                          0.6.31-15.el7               @anaconda
basesystem.noarch                          10.0-7.el7.centos           @anaconda
bash.x86_64                                4.2.46-19.el7               @anaconda
bind-libs-lite.x86_64                      32:9.9.4-29.el7             @anaconda
bind-license.noarch                        32:9.9.4-29.el7             @anaconda
binutils.x86_64                            2.23.52.0.1-55.el7          @anaconda
biosdevname.x86_64                         0.6.2-1.el7                 @anaconda
btrfs-progs.x86_64                         3.19.1-1.el7                @anaconda
bzip2-libs.x86_64                          1.0.6-13.el7                @anaconda
ca-certificates.noarch                     2015.2.4-71.el7             @anaconda
centos-logos.noarch                        70.0.6-3.el7.centos         @anaconda
centos-release.x86_64                      7-2.1511.el7.centos.2.10    @anaconda
chkconfig.x86_64                           1.3.61-5.el7                @anaconda
coreutils.x86_64                           8.22-15.el7                 @anaconda
cpio.x86_64                                2.11-24.el7                 @anaconda
cracklib.x86_64                            2.9.0-11.el7                @anaconda
cracklib-dicts.x86_64                      2.9.0-11.el7                @anaconda
cronie.x86_64                              1.4.11-14.el7               @anaconda
cronie-anacron.x86_64                      1.4.11-14.el7               @anaconda
crontabs.noarch                            1.11-6.20121102git.el7      @anaconda
cryptsetup-libs.x86_64                     1.6.7-1.el7                 @anaconda
curl.x86_64                                7.29.0-25.el7.centos        @anaconda
cyrus-sasl-lib.x86_64                      2.1.26-19.2.el7             @anaconda
dbus.x86_64                                1:1.6.12-13.el7             @anaconda
dbus-glib.x86_64                           0.100-7.el7                 @anaconda
dbus-libs.x86_64                           1:1.6.12-13.el7             @anaconda
dbus-python.x86_64                         1.1.1-9.el7                 @anaconda
device-mapper.x86_64                       7:1.02.107-5.el7            @anaconda
device-mapper-event.x86_64                 7:1.02.107-5.el7            @anaconda
device-mapper-event-libs.x86_64            7:1.02.107-5.el7            @anaconda
device-mapper-libs.x86_64                  7:1.02.107-5.el7            @anaconda


由于管道被破坏而退出

限于篇幅只能列出头50个 list命令先从从上例中可以看到有 “base: mirrors.pubyun.com” 信息出现,这是在告诉用户,它是从base: mirrors.pubyun.com这里下载到的rpm包资源。从上面的例子中您还可以看到最左侧是rpm包名字,中间是版本信息,最右侧是安装信息,如果安装了就显示类似 “@anaconda-CentOS”, “@base”
或者 “@extras”, 他们前面都会有一个 “@” 符号,这很好区分。未安装则显示base或者extras,
如果是该rpm包已安装但需要升级则显示updates. 如果您看的仔细会发现,”yum list” 会先列出已经安装的包(Installed Packages)
然后再列出可以安装的包(Available Packages)。你要知道这时一个巨大的工程 你会遇到海量的信息让你眼花缭乱。但是我们可以借助管道符改变这一点。

[root@desperadochn ~]# yum list |head -n 100 |grep "dbus"                          #在结果中匹配结果带“dbus”字符的包
dbus.x86_64                                1:1.6.12-13.el7             @anaconda
dbus-glib.x86_64                           0.100-7.el7                 @anaconda
dbus-libs.x86_64                           1:1.6.12-13.el7             @anaconda
dbus-python.x86_64                         1.1.1-9.el7                 @anaconda

2、搜索一个rpm包

[root@desperadochn ~]# yum search vim
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
============================================================================================================= N/S matched: vim =======================================
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
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-minimal.x86_64 : A minimal version of the VIM editor

同样支持grep过滤
 [root@desperadochn ~]# yum list |grep 'vim'
vim-minimal.x86_64                         2:7.4.160-1.el7             @anaconda
golang-vim.noarch                          1.3.3-2.el7_0               extras
protobuf-vim.x86_64                        2.5.0-8.el7                 base
vim-X11.x86_64                             2:7.4.160-1.el7             base
vim-common.x86_64                          2:7.4.160-1.el7             base
vim-enhanced.x86_64                        2:7.4.160-1.el7             base
vim-filesystem.x86_64                      2:7.4.160-1.el7             base

3、安装一个包名

[root@desperadochn ~]# yum install nano
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
正在解决依赖关系
–> 正在检查事务
—> 软件包 nano.x86_64.0.2.3.1-10.el7 将被 安装
–> 解决依赖关系完成

依赖关系解决

=============================================================================================================================================================================================================================================
 Package                                                架构                                                     版本                                                           源                                                      大小
=============================================================================================================================================================================================================================================
正在安装:
 nano                                                   x86_64                                                   2.3.1-10.el7                                                   base                                                   440 k

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

总下载量:440 k
安装大小:1.6 M
Is this ok [y/d/N]: y
Downloading packages:
nano-2.3.1-10.el7.x86_64.rpm                                                                                                                                                                                          | 440 kB  00:00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : nano-2.3.1-10.el7.x86_64                                                                                                                                                                                                 1/1
  验证中      : nano-2.3.1-10.el7.x86_64                                                                                                                                                                                                 1/1

已安装:
  nano.x86_64 0:2.3.1-10.el7

完毕!


3、卸载一个包

[root@desperadochn ~]# yum remove -y nano
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
---> 软件包 nano.x86_64.0.2.3.1-10.el7 将被 删除
--> 解决依赖关系完成

依赖关系解决

==========================================================================================================================================================================
 Package                                               架构                                                                                                              源                                                      大小
===========================================================================================================================================================================
正在删除:
 nano                                                  x86_64                                                                                                  @base                                                  1.6 M

事务概要
============================================================================================================================================================================

安装大小:1.6 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在删除    : nano-2.3.1-10.el7.x86_64                                                                                                                                                                                                 1/1
  验证中      : nano-2.3.1-10.el7.x86_64                                                                                                                                                                                                 1/1

删除:
  nano.x86_64 0:2.3.1-10.el7

完毕!

4、升级一个包

[root@desperadochn ~]# yum update  python-perf
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 python-perf.x86_64.0.3.10.0-327.el7 将被 升级
---> 软件包 python-perf.x86_64.0.3.10.0-327.10.1.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

==========================================================================================================================================================================
 Package                                                  架构                                                                                                           源                                                    大小
==========================================================================================================================================================================
正在更新:
 python-perf                                              x86_64                                                                                                                               2.4 M

事务概要
==========================================================================================================================================================================
升级  1 软件包

总下载量:2.4 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
python-perf-3.10.0-327.10.1.el7.x86_64.rpm                                                                                                                                                                            | 2.4 MB  00:00:23
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : python-perf-3.10.0-327.10.1.el7.x86_64                                                                                                                                                                                   1/2
  清理        : python-perf-3.10.0-327.el7.x86_64                                                                                                                                                                                        2/2
  验证中      : python-perf-3.10.0-327.10.1.el7.x86_64                                                                                                                                                                                   1/2
  验证中      : python-perf-3.10.0-327.el7.x86_64                                                                                                                                                                                        2/2

更新完毕:
  python-perf.x86_64 0:3.10.0-327.10.1.el7

完毕!

5、检查可更新的包

[root@desperadochn ~]# yum check-update
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com

avahi-autoipd.x86_64                                                                                                                                                                                                updates
avahi-libs.x86_64                                                                                                                                                                                                    updates
bind-libs-lite.x86_64                                                                                                                                                                                           updates
bind-license.noarch                                                                                                                                                                                             updates
ca-certificates.noarch                                                                                                                                                                                            updates
coreutils.x86_64                                                                                                                                                                                                      updates
cyrus-sasl-lib.x86_64                                                                                                                                                                                                updates
device-mapper.x86_64                                                                                                                                                                                             updates
device-mapper-event.x86_64                                                                                                                                                                                   updates
device-mapper-event-libs.x86_64                                                                                                                                                                               updates
device-mapper-libs.x86_64                                                                                                                                                                                       updates
dracut.x86_64                                                                                                                                                                                                         updates
dracut-config-rescue.x86_64                                                                                                                                                                                             updates
dracut-network.x86_64                                                                                                                                                                                                 updates
glibc.x86_64                                                                                                                                                                                                          updates
glibc-common.x86_64                                                                                                                                                                                                 updates
gmp.x86_64                                                                                                                                                                                                         updates
gnutls.x86_64                                                                                                                                                                                                           updates
grub2.x86_64                                                                                                                                                                                                   updates
grub2-tools.x86_64                                                                                                                                                                                             updates
kernel.x86_64                                                                                                                                                                                                     updates
kernel-tools.x86_64                                                                                                                                                                                              updates
kernel-tools-libs.x86_64                                                                                                                                                                                           updates
kexec-tools.x86_64                                                                                                                                                                                                    updates
libgudev1.x86_64                                                                                                                                                                                                      updates
libxml2.x86_64                                                                                                                                                                                                    updates
logrotate.x86_64                                                                                                                                                                                                     updates
lvm2.x86_64                                                                                                                                                                                                      updates
lvm2-libs.x86_64                                                                                                                                                                                                 updates
nss.x86_64                                                                                                                                                                                                            updates
nss-sysinit.x86_64                                                                                                                                                                                                   updates
nss-tools.x86_64                                                                                                                                                                                                       updates
numactl-libs.x86_64                                                                                                                                                                                                     updates
openssh.x86_64                                                                                                                                                                                                     updates
openssh-clients.x86_64                                                                                                                                                                                                updates
openssh-server.x86_64                                                                                                                                                                                               updates
openssl.x86_64                                                                                                                                                                                                     updates
openssl-libs.x86_64                                                                                                                                                                                               updates
polkit.x86_64                                                                                                                                                                                                     updates
procps-ng.x86_64                                                                                                                                                                                                      updates
python-pyudev.noarch                                                                                                                                                                                                 updates
rdma.noarch                                                                                                                                                                                                        updates
selinux-policy.noarch                                                                                                                                                                                             updates
selinux-policy-targeted.noarch                                                                                                                                                                                     updates
systemd.x86_64                                                                                                                                                                                                    updates
systemd-libs.x86_64                                                                                                                                                                                                    updates
systemd-sysv.x86_64                                                                                                                                                                                                    updates
tuned.noarch                                                                                                           
tzdata.noarch                                                                                                                                                                                                             updates

6、要大规模的升级版本

[root@desperadochn ~]# yum upgrade |head -n 50
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 avahi-autoipd.x86_64.0.0.6.31-15.el7 将被 升级
---> 软件包 avahi-autoipd.x86_64.0.0.6.31-15.el7_2.1 将被 更新
---> 软件包 avahi-libs.x86_64.0.0.6.31-15.el7 将被 升级
---> 软件包 avahi-libs.x86_64.0.0.6.31-15.el7_2.1 将被 更新
---> 软件包 bind-libs-lite.x86_64.32.9.9.4-29.el7 将被 升级
---> 软件包 bind-libs-lite.x86_64.32.9.9.4-29.el7_2.2 将被 更新
---> 软件包 bind-license.noarch.32.9.9.4-29.el7 将被 升级
---> 软件包 bind-license.noarch.32.9.9.4-29.el7_2.2 将被 更新
---> 软件包 ca-certificates.noarch.0.2015.2.4-71.el7 将被 升级
---> 软件包 ca-certificates.noarch.0.2015.2.6-70.1.el7_2 将被 更新
---> 软件包 coreutils.x86_64.0.8.22-15.el7 将被 升级
---> 软件包 coreutils.x86_64.0.8.22-15.el7_2.1 将被 更新
---> 软件包 cyrus-sasl-lib.x86_64.0.2.1.26-19.2.el7 将被 升级
---> 软件包 cyrus-sasl-lib.x86_64.0.2.1.26-20.el7_2 将被 更新
---> 软件包 device-mapper.x86_64.7.1.02.107-5.el7 将被 升级
---> 软件包 device-mapper.x86_64.7.1.02.107-5.el7_2.1 将被 更新
---> 软件包 device-mapper-event.x86_64.7.1.02.107-5.el7 将被 升级
---> 软件包 device-mapper-event.x86_64.7.1.02.107-5.el7_2.1 将被 更新
---> 软件包 device-mapper-event-libs.x86_64.7.1.02.107-5.el7 将被 升级
---> 软件包 device-mapper-event-libs.x86_64.7.1.02.107-5.el7_2.1 将被 更新
---> 软件包 device-mapper-libs.x86_64.7.1.02.107-5.el7 将被 升级
---> 软件包 device-mapper-libs.x86_64.7.1.02.107-5.el7_2.1 将被 更新
---> 软件包 dracut.x86_64.0.033-359.el7 将被 升级
---> 软件包 dracut.x86_64.0.033-360.el7_2 将被 更新
---> 软件包 dracut-config-rescue.x86_64.0.033-359.el7 将被 升级
---> 软件包 dracut-config-rescue.x86_64.0.033-360.el7_2 将被 更新
---> 软件包 dracut-network.x86_64.0.033-359.el7 将被 升级
---> 软件包 dracut-network.x86_64.0.033-360.el7_2 将被 更新
---> 软件包 glibc.x86_64.0.2.17-105.el7 将被 升级
---> 软件包 glibc.x86_64.0.2.17-106.el7_2.4 将被 更新
---> 软件包 glibc-common.x86_64.0.2.17-105.el7 将被 升级
---> 软件包 glibc-common.x86_64.0.2.17-106.el7_2.4 将被 更新
---> 软件包 gmp.x86_64.1.6.0.0-11.el7 将被 升级
---> 软件包 gmp.x86_64.1.6.0.0-12.el7_1 将被 更新
---> 软件包 gnutls.x86_64.0.3.3.8-12.el7_1.1 将被 升级
---> 软件包 gnutls.x86_64.0.3.3.8-14.el7_2 将被 更新
---> 软件包 grub2.x86_64.1.2.02-0.29.el7.centos 将被 升级
---> 软件包 grub2.x86_64.1.2.02-0.34.el7.centos 将被 更新
---> 软件包 grub2-tools.x86_64.1.2.02-0.29.el7.centos 将被 升级
---> 软件包 grub2-tools.x86_64.1.2.02-0.34.el7.centos 将被 更新
---> 软件包 kernel.x86_64.0.3.10.0-327.10.1.el7 将被 安装
---> 软件包 kernel-tools.x86_64.0.3.10.0-327.el7 将被 升级
---> 软件包 kernel-tools.x86_64.0.3.10.0-327.10.1.el7 将被 更新

限于篇幅只列出前50个内容,此条命令是大规模的升级版本,与yum update不同的是,陈旧的包也会升级

7、列出资源库中所有可以安装或更新的rpm包的信息:

[root@desperadochn ~]# yum info |head -n 50
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
已安装的软件包
名称    :NetworkManager
架构    :x86_64
时期       :1
版本    :1.0.6
发布    :27.el7
大小    :9.1 M
源    :installed
来自源:anaconda
简介    : Network connection manager and user applications
网址    :http://www.gnome.org/projects/NetworkManager/
协议    : GPLv2+
描述    : NetworkManager is a system service that manages network interfaces
         : and connections based on user or automatic configuration. It supports
         : Ethernet, Bridge, Bond, VLAN, Team, InfiniBand, Wi-Fi, mobile
         : broadband (WWAN), PPPoE and other devices, and supports a variety of
         : different VPN services.

名称    :NetworkManager-libnm
架构    :x86_64
时期       :1
版本    :1.0.6
发布    :27.el7
大小    :1.5 M
源    :installed
来自源:anaconda
简介    : Libraries for adding NetworkManager support to applications (new
         : API).
网址    :http://www.gnome.org/projects/NetworkManager/
协议    : GPLv2+
描述    : This package contains the libraries that make it easier to use some
         : NetworkManager functionality from applications.  This is the new
         : NetworkManager API.  See also NetworkManager-glib.

名称    :NetworkManager-team
架构    :x86_64
时期       :1
版本    :1.0.6
发布    :27.el7
大小    :32 k
源    :installed
来自源:anaconda
简介    : Team device plugin for NetworkManager
网址    :http://www.gnome.org/projects/NetworkManager/
协议    : GPLv2+


由于管道被破坏而退出

这是一个巨大的工程,我的屏幕闪的不停,它会产生海量信息因此限于篇幅只能列出前50行输出内容

8、列出资源库特定的可以安装或更新以及已经安装的rpm包信息

[root@desperadochn ~]# yum info tree
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
已安装的软件包
名称    :tree
架构    :x86_64
版本    :1.6.0
发布    :10.el7
大小    :87 k
源    :installed
来自源:base
简介    : File system tree viewer
网址    :http://mama.indstate.edu/users/ice/tree/
协议    : GPLv2+
描述    : The tree utility recursively displays the contents of directories in a
         : tree-like format.  Tree is basically a UNIX port of the DOS tree
         : utility.

9、列出资源库中所有可以更新的rpm包信息

[root@desperadochn ~]# yum info updates |head -n 50
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
更新的软件包
名称    :avahi-autoipd
架构    :x86_64
版本    :0.6.31
发布    :15.el7_2.1
大小    :39 k
源    :updates/7/x86_64
简介    : Link-local IPv4 address automatic configuration daemon (IPv4LL)
网址    :http://avahi.org
协议    : LGPLv2+
描述    : avahi-autoipd implements IPv4LL, "Dynamic Configuration of IPv4
         : Link-Local Addresses"  (IETF RFC3927), a protocol for automatic IP
         : address configuration from the link-local 169.254.0.0/16 range
         : without the need for a central server. It is primarily intended to be
         : used in ad-hoc networks which lack a DHCP server.

名称    :avahi-libs
架构    :x86_64
版本    :0.6.31
发布    :15.el7_2.1
大小    :61 k
源    :updates/7/x86_64
简介    : Libraries for avahi run-time use
网址    :http://avahi.org
协议    : LGPLv2+
描述    : The avahi-libs package contains the libraries needed
         : to run programs that use avahi.

名称    :bind-libs-lite
架构    :x86_64
时期       :32
版本    :9.9.4
发布    :29.el7_2.2
大小    :724 k
源    :updates/7/x86_64
简介    : Libraries for working with the DNS protocol
网址    :http://www.isc.org/products/BIND/
协议    : ISC
描述    : Contains lite version of BIND suite libraries which are used by
         : various programs to work with DNS protocol.

名称    :bind-license
架构    :noarch
时期       :32
版本    :9.9.4


由于管道被破坏而退出

  这是一个巨大的工程,我的屏幕闪的不停,它会产生海量信息因此限于篇幅只能列出前50行输出内容

10、列出所有已安装的rpm包信息

[root@desperadochn ~]# yum info installed |head -n 50
已加载插件:fastestmirror
已安装的软件包
名称    :NetworkManager
架构    :x86_64
时期       :1
版本    :1.0.6
发布    :27.el7
大小    :9.1 M
源    :installed
来自源:anaconda
简介    : Network connection manager and user applications
网址    :http://www.gnome.org/projects/NetworkManager/
协议    : GPLv2+
描述    : NetworkManager is a system service that manages network interfaces
         : and connections based on user or automatic configuration. It supports
         : Ethernet, Bridge, Bond, VLAN, Team, InfiniBand, Wi-Fi, mobile
         : broadband (WWAN), PPPoE and other devices, and supports a variety of
         : different VPN services.

名称    :NetworkManager-libnm
架构    :x86_64
时期       :1
版本    :1.0.6
发布    :27.el7
大小    :1.5 M
源    :installed
来自源:anaconda
简介    : Libraries for adding NetworkManager support to applications (new
         : API).
网址    :http://www.gnome.org/projects/NetworkManager/
协议    : GPLv2+
描述    : This package contains the libraries that make it easier to use some
         : NetworkManager functionality from applications.  This is the new
         : NetworkManager API.  See also NetworkManager-glib.

名称    :NetworkManager-team
架构    :x86_64
时期       :1
版本    :1.0.6
发布    :27.el7
大小    :32 k
源    :installed
来自源:anaconda
简介    : Team device plugin for NetworkManager
网址    :http://www.gnome.org/projects/NetworkManager/
协议    : GPLv2+
描述    : This package contains NetworkManager support for team devices.

名称    :NetworkManager-tui
架构    :x86_64


由于管道被破坏而退出

这是一个巨大的工程,我的屏幕闪的不停,它会产生海量信息因此限于篇幅只能列出前50行输出内容

11、列出已经安装但是不包含在资源库中的包

[root@desperadochn ~]# yum info extras
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com

然而并没有。

12、列出资源库中所有可以更新的rpm包

[root@desperadochn ~]# yum list updates |head -n 50
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.skyshe.cn
 * updates: mirrors.pubyun.com
更新的软件包
avahi-autoipd.x86_64                     0.6.31-15.el7_2.1               updates
avahi-libs.x86_64                        0.6.31-15.el7_2.1               updates
bind-libs-lite.x86_64                    32:9.9.4-29.el7_2.2             updates
bind-license.noarch                      32:9.9.4-29.el7_2.2             updates
ca-certificates.noarch                   2015.2.6-70.1.el7_2             updates
coreutils.x86_64                         8.22-15.el7_2.1                 updates
cyrus-sasl-lib.x86_64                    2.1.26-20.el7_2                 updates
device-mapper.x86_64                     7:1.02.107-5.el7_2.1            updates
device-mapper-event.x86_64               7:1.02.107-5.el7_2.1            updates
device-mapper-event-libs.x86_64          7:1.02.107-5.el7_2.1            updates
device-mapper-libs.x86_64                7:1.02.107-5.el7_2.1            updates
dracut.x86_64                            033-360.el7_2                   updates
dracut-config-rescue.x86_64              033-360.el7_2                   updates
dracut-network.x86_64                    033-360.el7_2                   updates
glibc.x86_64                             2.17-106.el7_2.4                updates
glibc-common.x86_64                      2.17-106.el7_2.4                updates
gmp.x86_64                               1:6.0.0-12.el7_1                updates
gnutls.x86_64                            3.3.8-14.el7_2                  updates
grub2.x86_64                             1:2.02-0.34.el7.centos          updates
grub2-tools.x86_64                       1:2.02-0.34.el7.centos          updates
kernel.x86_64                            3.10.0-327.10.1.el7             updates
kernel-tools.x86_64                      3.10.0-327.10.1.el7             updates
kernel-tools-libs.x86_64                 3.10.0-327.10.1.el7             updates
kexec-tools.x86_64                       2.0.7-38.el7_2.1                updates
libgudev1.x86_64                         219-19.el7_2.4                  updates
libxml2.x86_64                           2.9.1-6.el7_2.2                 updates
logrotate.x86_64                         3.8.6-7.el7_2                   updates
lvm2.x86_64                              7:2.02.130-5.el7_2.1            updates
lvm2-libs.x86_64                         7:2.02.130-5.el7_2.1            updates
nss.x86_64                               3.19.1-19.el7_2                 updates
nss-sysinit.x86_64                       3.19.1-19.el7_2                 updates
nss-tools.x86_64                         3.19.1-19.el7_2                 updates
numactl-libs.x86_64                      2.0.9-6.el7_2                   updates
openssh.x86_64                           6.6.1p1-23.el7_2                updates
openssh-clients.x86_64                   6.6.1p1-23.el7_2                updates
openssh-server.x86_64                    6.6.1p1-23.el7_2                updates
openssl.x86_64                           1:1.0.1e-51.el7_2.2             updates
openssl-libs.x86_64                      1:1.0.1e-51.el7_2.2             updates
polkit.x86_64                            0.112-6.el7_2                   updates
procps-ng.x86_64                         3.3.10-5.el7_2                  updates
python-pyudev.noarch                     0.15-7.el7_2.1                  updates
rdma.noarch                              7.2_4.1_rc6-2.el7               updates
selinux-policy.noarch                    3.13.1-60.el7_2.3               updates
selinux-policy-targeted.noarch           3.13.1-60.el7_2.3               updates

由于输出过多,只显示前50行。

GPG:GPG :(全称 GnuPG )
是一款非对称加密(PGP)的免费软件,非对称加密方式简单讲就是指用公钥加密文件,用私钥解密文件。如果你想给谁发送加密信息,首先你要得到他的公钥,然后通过该公钥加密后传给他,对方利用自已的私钥就可解密并读取文件了。

v、参考文献

《循序渐进linux》第二版 高俊峰

《linux应用大全-基础与管理》 於岳

《linux技术手册》第六版 Ellen SieverStephen FigginsRobert LoveArnold Robbins



原创文章,作者:Net17_desperado,如若转载,请注明出处:http://www.178linux.com/11841

(1)
Net17_desperadoNet17_desperado
上一篇 2016-02-28
下一篇 2016-03-01

相关推荐

  • Centos 7 快速进入图形界面

    Centos 7 快速进入图形界面.pdf

    系统运维 2016-04-05
  • 快速搭建SVN服务器

    一、背景介绍 svn服务器是一款上传代码的工具(貌似这么说不怎么严谨,但是在日常工作中基本上是这么用的),今天一个小伙伴折腾了一天也没有搭建好这个svn服务器。各种问题,其实搭建SVN服务器最重要的就是三个配置文件(svnserver.conf、 passwd 、authz)。出了问题的话十有八九是这三个配置文件的问题。最后,我自己搭建了一个,测试成功。于是…

    Linux干货 2016-12-11
  • 文本处理grep

    grep:文本过滤(模式:pattern)工具grep, egrep, fgrep【适合处理比较大的文本】(不支持正则表达式搜索) sed:stream editor,文本编辑工具 awk:Linux上的实现gawk,文本报告生成器 grep(Global search 全局搜索 Regular expression 正则表达式 and Print out …

    Linux干货 2017-05-09
  • 网络管理

    一、网络概念     什么是网络     资源共享的功能和优点         数据和应用程序         资源 &…

    Linux干货 2016-09-09
  • 马哥教育的第一天

    春天的北京,比想象中的更加温暖,跨越一千三百公里的距离,我来到马哥教育位于北京昌平区的校区,传说中的春寒料峭似乎遗忘了北京,自湖北出门的时候,车外还是淅淅沥沥的小雨,到达北京,迎接我的却是春风拂面熏人醉。 安顿了两天之后,我们三十期的开班典礼在三月二十六号早上的九点钟准时开始,由云珍老师主持,传说中的马哥、王老师、张sir、宗华老师纷纷登台致辞,分别从运维工…

    2018-03-26
  • Nginx基本使用方法及各模块基本功能

    一、Nginx介绍     Nginx是由俄罗斯软件工程师Igor Sysoev开发的一个高性能的HTTP和反向代理服务器,具备IMAP/POP3和SMTP服务器功能,Nginx最大的特点是对高并发的支持和高效的负载均衡,在高并发的需求场景下,是Apache服务器不错的替代品。目前,包括新浪、腾讯等知名网站都已使用Nginx作为Web应用…

    Linux干货 2016-01-21

评论列表(1条)

  • stanley
    stanley 2016-03-03 09:46

    5w1h的自我发问非常棒,能做进行样式优化突出显示作为文章核心价值点会很赞,格式上做细致整理可以推公众号了,加油