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
安裝大?。?.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

事務概要
============================================================================================================================================================================

安裝大?。?.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 Siever,Stephen FigginsRobert Love,Arnold Robbins



原創文章,作者:Net17_desperado,如若轉載,請注明出處:http://www.www58058.com/11841

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

相關推薦

  • linux軟件包管理(開始上正菜了)

    linux程序包管理:     API:數據接口     ABI:應用程序二進制接口        庫級別的虛擬化:             linux:wine    …

    Linux干貨 2017-03-07
  • Linux系統壓縮和解壓縮工具gzip、bzip2、xz以及tar打包工具總結

    在Linux系統使用過程中,對于一些不是常用的文件,利用cpu的時間資源對文件進行壓縮可以節省一定的磁盤空間,對系統中某個目錄經常會有備份的需求,可以使用Linux系統中的tar打包工具實現,文件的壓縮對于大量的網絡文件傳輸可以節約帶寬,同時也能降低服務器的負載,我們經常需要從網站下載軟件包到本地主機,這些包基本都是打包壓縮的,要想使用安裝,需要我們解壓縮他…

    Linux干貨 2016-08-18
  • bash語句的具體應用之“顯示/etc/passwd文件中ID號最大的用戶的用戶名?”

    問題:顯示/etc/passwd文件中ID號最大的用戶的用戶名 回答:sort -t; -k3 -n /etc/passwd | tail -1 |cut -d: -f1 看似很簡答的一個回答,其實其中包含了多個命令的使用方法: 第一個用到的命令:sort sort命令是幫我們依據不同的數據類型進行排序,其語法及常用參數格式:  sort [-bcfMnrt…

    Linux干貨 2016-04-11
  • Linux系統的終端類型

    Linux系統的終端類型    Linux系統的終端主要包括控制臺終端、控制終端、串口終端、偽終端、虛擬終端。 1.  控制臺終端(/dev/console)。    在Unix系統中,計算機顯示器通常被稱為控制臺終端。Console與虛擬終端相關聯,內核將信息送到控制臺終端上(/dev/conso…

    Linux干貨 2015-09-14
  • Mogilefs使用Nginx實現代理訪問

    MogileFS介紹:  MogileFS是一個開源的分布式文件存儲系統,由LiveJournal旗下的DangaInteracitve公司研發??芍С治募詣觽浞堑墓δ?,提供高可用性和高可擴展性。 MogileFS組件:  trackers:   MoglieFS的調度器,是mogileFS的核心,訪問入口。  功能…

    Linux干貨 2015-08-06
  • Linux計劃任務

    計劃任務 工作當中有時候需要將某件事情在未來的某個特定的時間執行,而自己確不在機器旁,該如何是好?像這樣在每天特定的時間內去安排做一些事情這樣,一種事情我們就稱之為例行性的計劃任務,其實在我們的操作系統當中都有類似的例行性任務計劃功能,那如何去像設定鬧鐘一種在Linux上指定例行性計劃任務并實施,主要有兩種工具:at和crontab   計劃任務分…

    Linux干貨 2016-09-19

評論列表(1條)

  • stanley
    stanley 2016-03-03 09:46

    5w1h的自我發問非常棒,能做進行樣式優化突出顯示作為文章核心價值點會很贊,格式上做細致整理可以推公眾號了,加油

欧美性久久久久