码迷,mamicode.com
首页 > 系统相关 > 详细

Linux功能-使用YUM管理软件包

时间:2016-11-02 17:51:36      阅读:500      评论:0      收藏:0      [点我收藏+]

标签:minimal   tor   virtual   user   efault   man   with   console   tool   

 一、概念

YUM,全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。基於RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载、安装。

二、实例

1. 使用yum 命令显示所有软件存储库信息

[root@desktop1 ~]# yum repolist
Loaded plugins: langpacks
Packages                                                                                   | 4.1 kB  00:00:00     
repo id                                               repo name                                             status
Packages                                              Packages                                              4,305
repolist: 4,305

2. 用 yum 命令,安装/rhel7/dvd/Packages/bind-9.9.4-14.el7.x86_64.rpm 

[root@desktop1 ~]# yum localinstall /rhel7/dvd/Packages/bind-9.9.4-14.el7.x86_64.rpm 
Loaded plugins: langpacks
Examining /rhel7/dvd/Packages/bind-9.9.4-14.el7.x86_64.rpm: 32:bind-9.9.4-14.el7.x86_64
Marking /rhel7/dvd/Packages/bind-9.9.4-14.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.9.4-14.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package           Arch                Version                       Repository                              Size
==================================================================================================================
Installing:
 bind              x86_64              32:9.9.4-14.el7               /bind-9.9.4-14.el7.x86_64              4.3 M

Transaction Summary
==================================================================================================================
Install  1 Package

Total size: 4.3 M
Installed size: 4.3 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 32:bind-9.9.4-14.el7.x86_64                                                                    1/1 
  Verifying  : 32:bind-9.9.4-14.el7.x86_64                                                                    1/1 

Installed:
  bind.x86_64 32:9.9.4-14.el7                                                                                     

Complete!

3. 用yum list命令找出“bind”这个软件包,观察描述信息,@/bind-9.9.4-14.el7.x86_64”,表示已被安装上了 

即包名称前存在符号“@”为已安装

[root@desktop1 ~]# yum list bind
Loaded plugins: langpacks
Installed Packages
bind.x86_64                               32:9.9.4-14.el7                               @/bind-9.9.4-14.el7.x86_64

4. 用yum list命令找出“tftp-server”这个软件包,观察描述信息是Package,包前没有@符号,表示未安装

[root@desktop1 ~]# yum list tftp-server
Loaded plugins: langpacks
Available Packages
tftp-server.x86_64                                       5.2-11.el7                                       Packages

5. 用 yum 命令安装 tftp-server 这个软件包,有任何交互提问,直接回答 yes 

[root@desktop1 ~]# yum -y install tftp-server
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package tftp-server.x86_64 0:5.2-11.el7 will be installed
--> Processing Dependency: xinetd for package: tftp-server-5.2-11.el7.x86_64
--> Running transaction check
---> Package xinetd.x86_64 2:2.3.15-12.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                    Arch                  Version                           Repository               Size
==================================================================================================================
Installing:
 tftp-server                x86_64                5.2-11.el7                        Packages                 44 k
Installing for dependencies:
 xinetd                     x86_64                2:2.3.15-12.el7                   Packages                128 k

Transaction Summary
==================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 172 k
Installed size: 325 k
Downloading packages:
(1/2): tftp-server-5.2-11.el7.x86_64.rpm                                                   |  44 kB  00:00:00     
(2/2): xinetd-2.3.15-12.el7.x86_64.rpm                                                     | 128 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------
Total                                                                             772 kB/s | 172 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 2:xinetd-2.3.15-12.el7.x86_64                                                                  1/2 
  Installing : tftp-server-5.2-11.el7.x86_64                                                                  2/2 
  Verifying  : 2:xinetd-2.3.15-12.el7.x86_64                                                                  1/2 
  Verifying  : tftp-server-5.2-11.el7.x86_64                                                                  2/2 

Installed:
  tftp-server.x86_64 0:5.2-11.el7                                                                                 

Dependency Installed:
  xinetd.x86_64 2:2.3.15-12.el7                                                                                   

Complete!
[root@desktop1 ~]# 

6. 再次查看“tftp-server”这个软件包的安装情况,Package前已存在@符号

[root@desktop1 ~]# yum list tftp-server
Loaded plugins: langpacks
Installed Packages
tftp-server.x86_64                                      5.2-11.el7                                       @Packages
[root@desktop1 ~]# 

7. 检查所有以安装的软件包,可以看到几乎所有都是@anaconda(安装系统时就安装了) 

[root@desktop1 ~]# yum list installed
Loaded plugins: langpacks
Installed Packages
GConf2.x86_64                                         3.2.6-8.el7                          @anaconda/7.0          
ModemManager.x86_64                                   1.1.0-6.git20130913.el7              @anaconda/7.0          
ModemManager-glib.x86_64                              1.1.0-6.git20130913.el7              @anaconda/7.0          
NetworkManager.x86_64                                 1:0.9.9.1-13.git20140326.4dba720.el7 @anaconda/7.0          
NetworkManager-config-server.x86_64                   1:0.9.9.1-13.git20140326.4dba720.el7 @anaconda/7.0          
NetworkManager-glib.x86_64                            1:0.9.9.1-13.git20140326.4dba720.el7 @anaconda/7.0      
...

8.  显示所有未安装的软件包,Packages前无@符号

[root@desktop1 ~]# yum list available
Loaded plugins: langpacks
Available Packages
389-ds-base.x86_64                                           1.3.1.6-25.el7                               Packages
389-ds-base-libs.x86_64                                      1.3.1.6-25.el7                               Packages
ElectricFence.i686                                           2.2.2-39.el7                                 Packages
ElectricFence.x86_64                                         2.2.2-39.el7                                 Packages
GConf2.i686                                                  3.2.6-8.el7                                  Packages
GeoIP.i686                                                   1.5.0-9.el7                                  Packages
GeoIP.x86_64                                                 1.5.0-9.el7                                  Packages

9. 用 yum search 命令,找出所有名称或描述信息中,含有 SSH 字符串的软件包 

   search  :搜寻某个软件名称或者是描述 (description) 的重要关键字

[root@desktop1 ~]# yum search SSH
Loaded plugins: langpacks
================================================ N/S matched: SSH ================================================
ksshaskpass.x86_64 : A KDE version of ssh-askpass with KWallet support
libssh2.i686 : A library implementing the SSH2 protocol
libssh2.x86_64 : A library implementing the SSH2 protocol
openssh.x86_64 : An open source implementation of SSH protocol versions 1 and 2
openssh-askpass.x86_64 : A passphrase dialog for OpenSSH and X
openssh-clients.x86_64 : An open source SSH client applications
openssh-keycat.x86_64 : A mls keycat backend for openssh
openssh-server.x86_64 : An open source SSH server daemon

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

  [root@desktop1 ~]# yum search tftp
  Loaded plugins: langpacks
  =============================================== N/S matched: tftp ================================================
  tftp.x86_64 : The client for the Trivial File Transfer Protocol (TFTP)
  tftp-server.x86_64 : The server for the Trivial File Transfer Protocol (TFTP)

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

10. 用 yum list 命令,找出名称中有“ssh”的字符串的软件软件包 

   list    :列出目前 yum 所管理的所有的软件名称与版本,有点类似 rpm -qa;

[root@desktop1 ~]# yum list *ssh*
Loaded plugins: langpacks
Installed Packages
libssh2.x86_64                                          1.4.3-8.el7                                  @anaconda/7.0
openssh.x86_64                                          6.4p1-8.el7                                  @anaconda/7.0
openssh-clients.x86_64                                  6.4p1-8.el7                                  @anaconda/7.0
openssh-server.x86_64                                   6.4p1-8.el7                                  @anaconda/7.0
Available Packages
ksshaskpass.x86_64                                      0.5.3-7.el7                                  Packages     
libssh2.i686                                            1.4.3-8.el7                                  Packages     
openssh-askpass.x86_64                                  6.4p1-8.el7                                  Packages     
openssh-keycat.x86_64                                   6.4p1-8.el7                                  Packages     

11. 用 yum 命令,显示/etc/named.conf 这个文件是哪个软件包提供的 

[root@desktop1 ~]# yum provides /etc/named.conf 
Loaded plugins: langpacks
32:bind-9.9.4-14.el7.x86_64 : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server
Repo        : Packages
Matched from:
Filename    : /etc/named.conf

32:bind-9.9.4-14.el7.x86_64 : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server
Repo        : @/bind-9.9.4-14.el7.x86_64
Matched from:
Filename    : /etc/named.conf

[root@desktop1 ~]# 

12. 使用yum卸载bind软件包

[root@desktop1 ~]# yum remove bind
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.9.4-14.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package           Arch                Version                      Repository                               Size
==================================================================================================================
Removing:
 bind              x86_64              32:9.9.4-14.el7              @/bind-9.9.4-14.el7.x86_64              4.3 M

Transaction Summary
==================================================================================================================
Remove  1 Package

Installed size: 4.3 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : 32:bind-9.9.4-14.el7.x86_64                                                                    1/1 
  Verifying  : 32:bind-9.9.4-14.el7.x86_64                                                                    1/1 

Removed:
  bind.x86_64 32:9.9.4-14.el7                                                                                     

Complete!
[root@desktop1 ~]# 

13. 用 yum 命令,检查所有可以用的软件组(包括被隐藏的也显示出来) 

[root@desktop1 ~]# yum group list hidden
Loaded plugins: langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Available environment groups:
   Minimal Install
   Infrastructure Server
   File and Print Server
   Basic Web Server
   Virtualization Host
   Server with GUI
Available Groups:
   Additional Development
   Anaconda Tools
   Backup Client
   Backup Server
   Base
   Compatibility Libraries
   Conflicts (Server)
   Console Internet Tools
   Core
   DNS Name Server
   Debugging Tools
   Desktop Debugging and Performance Tools
   Development Tools
   Dial-up Networking Support
   Directory Client
   Directory Server
   E-mail Server
   Emacs
   FTP Server
   File and Storage Server
   Fonts
   GNOME
   Graphical Administration Tools
   Graphics Creation Tools
   Guest Agents
   Guest Desktop Agents
   Hardware Monitoring Utilities
   Identity Management Server
   Infiniband Support
   Input Methods
   Internet Browser
   Java Platform
   KDE
   Large Systems Performance
   Legacy UNIX Compatibility
   Legacy X Window System Compatibility
   Load Balancer
   Mainframe Access
   MariaDB Database Client
   MariaDB Database Server
   Multimedia
   Network File System Client
   Network Infrastructure Server
   Networking Tools
   PHP Support
   Performance Tools
   Perl Support
   Perl for Web
   Platform Development
   PostgreSQL Database Client
   PostgreSQL Database Server
   Print Server
   Printing Client
   Python
   Remote Desktop Clients
   Remote Management for Linux
   Ruby Support
   Scientific Support
   Security Tools
   Smart Card Support
   System Administration Tools
   System Management
   Technical Writing
   Virtualization Client
   Virtualization Hypervisor
   Virtualization Platform
   Virtualization Tools
   Web Server
   Web Servlet Engine
   X Window System
Done
[root@desktop1 ~]# 

14. 检查组“Web Server”包含的信息 

[root@desktop1 ~]# yum group info "Web Server"
Loaded plugins: langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)

Group: Web Server
 Group-Id: web-server
 Description: Allows the system to act as a web server, and run Perl and Python web applications.
 Mandatory Packages:
   +httpd
 Default Packages:
   +crypto-utils
   +httpd-manual
   +mod_fcgid
   +mod_ssl
 Optional Packages:
   certmonger
   libmemcached
   memcached
   mod_auth_kerb
   mod_nss
   mod_revocator
   mod_security
   mod_security_crs
   perl-CGI
   perl-CGI-Session
   python-memcached
   squid
[root@desktop1 ~]# 

15. 用 yum 命令,安装软件组“Web Server” 

[root@desktop1 ~]# yum group install "Web Server"
Loaded plugins: langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Resolving Dependencies
--> Running transaction check
---> Package crypto-utils.x86_64 0:2.4.1-42.el7 will be installed
--> Processing Dependency: perl(Newt) for package: crypto-utils-2.4.1-42.el7.x86_64
---> Package httpd.x86_64 0:2.4.6-17.el7 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-17.el7 for package: httpd-2.4.6-17.el7.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64
---> Package httpd-manual.noarch 0:2.4.6-17.el7 will be installed
---> Package mod_fcgid.x86_64 0:2.3.9-4.el7 will be installed
---> Package mod_ssl.x86_64 1:2.4.6-17.el7 will be installed
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-17.el7 will be installed
---> Package perl-Newt.x86_64 0:1.08-36.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                     Arch                  Version                          Repository               Size
==================================================================================================================
Installing for group install "Web Server":
 crypto-utils                x86_64                2.4.1-42.el7                     Packages                 78 k
 httpd                       x86_64                2.4.6-17.el7                     Packages                1.2 M
 httpd-manual                noarch                2.4.6-17.el7                     Packages                1.3 M
 mod_fcgid                   x86_64                2.3.9-4.el7                      Packages                 79 k
 mod_ssl                     x86_64                1:2.4.6-17.el7                   Packages                 97 k
Installing for dependencies:
 apr                         x86_64                1.4.8-3.el7                      Packages                103 k
 apr-util                    x86_64                1.5.2-6.el7                      Packages                 92 k
 httpd-tools                 x86_64                2.4.6-17.el7                     Packages                 77 k
 perl-Newt                   x86_64                1.08-36.el7                      Packages                 64 k

Transaction Summary
==================================================================================================================
Install  5 Packages (+4 Dependent packages)

Total download size: 3.1 M
Installed size: 10 M
Is this ok [y/d/N]: y
Downloading packages:
(1/9): apr-1.4.8-3.el7.x86_64.rpm                                                          | 103 kB  00:00:00     
(2/9): crypto-utils-2.4.1-42.el7.x86_64.rpm                                                |  78 kB  00:00:00     
(3/9): apr-util-1.5.2-6.el7.x86_64.rpm                                                     |  92 kB  00:00:00     
(4/9): httpd-2.4.6-17.el7.x86_64.rpm                                                       | 1.2 MB  00:00:00     
(5/9): httpd-tools-2.4.6-17.el7.x86_64.rpm                                                 |  77 kB  00:00:00     
(6/9): mod_fcgid-2.3.9-4.el7.x86_64.rpm                                                    |  79 kB  00:00:00     
(7/9): mod_ssl-2.4.6-17.el7.x86_64.rpm                                                     |  97 kB  00:00:00     
(8/9): perl-Newt-1.08-36.el7.x86_64.rpm                                                    |  64 kB  00:00:00     
(9/9): httpd-manual-2.4.6-17.el7.noarch.rpm                                                | 1.3 MB  00:00:00     
------------------------------------------------------------------------------------------------------------------
Total                                                                             7.0 MB/s | 3.1 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-3.el7.x86_64                                                                         1/9 
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                    2/9 
  Installing : httpd-tools-2.4.6-17.el7.x86_64                                                                3/9 
  Installing : httpd-2.4.6-17.el7.x86_64                                                                      4/9 
  Installing : perl-Newt-1.08-36.el7.x86_64                                                                   5/9 
  Installing : crypto-utils-2.4.1-42.el7.x86_64                                                               6/9 
  Installing : mod_fcgid-2.3.9-4.el7.x86_64                                                                   7/9 
  Installing : httpd-manual-2.4.6-17.el7.noarch                                                               8/9 
  Installing : 1:mod_ssl-2.4.6-17.el7.x86_64                                                                  9/9 
  Verifying  : mod_fcgid-2.3.9-4.el7.x86_64                                                                   1/9 
  Verifying  : httpd-manual-2.4.6-17.el7.noarch                                                               2/9 
  Verifying  : perl-Newt-1.08-36.el7.x86_64                                                                   3/9 
  Verifying  : 1:mod_ssl-2.4.6-17.el7.x86_64                                                                  4/9 
  Verifying  : httpd-2.4.6-17.el7.x86_64                                                                      5/9 
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                    6/9 
  Verifying  : httpd-tools-2.4.6-17.el7.x86_64                                                                7/9 
  Verifying  : apr-1.4.8-3.el7.x86_64                                                                         8/9 
  Verifying  : crypto-utils-2.4.1-42.el7.x86_64                                                               9/9 

Installed:
  crypto-utils.x86_64 0:2.4.1-42.el7     httpd.x86_64 0:2.4.6-17.el7       httpd-manual.noarch 0:2.4.6-17.el7    
  mod_fcgid.x86_64 0:2.3.9-4.el7         mod_ssl.x86_64 1:2.4.6-17.el7    

Dependency Installed:
  apr.x86_64 0:1.4.8-3.el7             apr-util.x86_64 0:1.5.2-6.el7       httpd-tools.x86_64 0:2.4.6-17.el7      
  perl-Newt.x86_64 0:1.08-36.el7      

Complete!
[root@desktop1 ~]# 

16. 检查“Web Server”的信息,强制安装和默认安装的包都标记为已安装“=” 

[root@desktop1 ~]# yum group info "Web Server"
Loaded plugins: langpacks

Group: Web Server
 Group-Id: web-server
 Description: Allows the system to act as a web server, and run Perl and Python web applications.
 Mandatory Packages:
   =httpd
 Default Packages:
   =crypto-utils
   =httpd-manual
   =mod_fcgid
   =mod_ssl
 Optional Packages:
   certmonger
   libmemcached
   memcached
   mod_auth_kerb
   mod_nss
   mod_revocator
   mod_security
   mod_security_crs
   perl-CGI
   perl-CGI-Session
   python-memcached
   squid
[root@desktop1 ~]# 

17. 卸载软件组“Web Server”,并确认卸载成功 

[root@desktop1 ~]# yum group remove "Web Server"
Loaded plugins: langpacks
No environment named Web Server exists
Resolving Dependencies
--> Running transaction check
---> Package crypto-utils.x86_64 0:2.4.1-42.el7 will be erased
---> Package httpd.x86_64 0:2.4.6-17.el7 will be erased
---> Package httpd-manual.noarch 0:2.4.6-17.el7 will be erased
---> Package mod_fcgid.x86_64 0:2.3.9-4.el7 will be erased
---> Package mod_ssl.x86_64 1:2.4.6-17.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                     Arch                  Version                         Repository                Size
==================================================================================================================
Removing:
 crypto-utils                x86_64                2.4.1-42.el7                    @Packages                179 k
 httpd                       x86_64                2.4.6-17.el7                    @Packages                3.7 M
 httpd-manual                noarch                2.4.6-17.el7                    @Packages                5.5 M
 mod_fcgid                   x86_64                2.3.9-4.el7                     @Packages                228 k
 mod_ssl                     x86_64                1:2.4.6-17.el7                  @Packages                219 k

Transaction Summary
==================================================================================================================
Remove  5 Packages

Installed size: 9.7 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : 1:mod_ssl-2.4.6-17.el7.x86_64                                                                  1/5 
  Erasing    : httpd-manual-2.4.6-17.el7.noarch                                                               2/5 
  Erasing    : mod_fcgid-2.3.9-4.el7.x86_64                                                                   3/5 
  Erasing    : httpd-2.4.6-17.el7.x86_64                                                                      4/5 
  Erasing    : crypto-utils-2.4.1-42.el7.x86_64                                                               5/5 
  Verifying  : crypto-utils-2.4.1-42.el7.x86_64                                                               1/5 
  Verifying  : mod_fcgid-2.3.9-4.el7.x86_64                                                                   2/5 
  Verifying  : httpd-manual-2.4.6-17.el7.noarch                                                               3/5 
  Verifying  : 1:mod_ssl-2.4.6-17.el7.x86_64                                                                  4/5 
  Verifying  : httpd-2.4.6-17.el7.x86_64                                                                      5/5 

Removed:
  crypto-utils.x86_64 0:2.4.1-42.el7     httpd.x86_64 0:2.4.6-17.el7       httpd-manual.noarch 0:2.4.6-17.el7    
  mod_fcgid.x86_64 0:2.3.9-4.el7         mod_ssl.x86_64 1:2.4.6-17.el7    

Complete!
[root@desktop1 ~]# yum group info "Web Server"
Loaded plugins: langpacks

Group: Web Server
 Group-Id: web-server
 Description: Allows the system to act as a web server, and run Perl and Python web applications.
 Mandatory Packages:
   +httpd
 Default Packages:
   +crypto-utils
   +httpd-manual
   +mod_fcgid
   +mod_ssl
 Optional Packages:
   certmonger
   libmemcached
   memcached
   mod_auth_kerb
   mod_nss
   mod_revocator
   mod_security
   mod_security_crs
   perl-CGI
   perl-CGI-Session
   python-memcached
   squid
[root@desktop1 ~]# 

18. 用 tail 命令,观察 yum 的日志文件,前面的安装和移除操作都被记录在日志文件中  

[root@desktop1 ~]# grep "log" /etc/yum.conf         #yum 的配置文件定义了日志的位置
logfile=/var/log/yum.log
[root@desktop1 ~]# tail -n 20 /var/log/yum.log 
Nov 02 14:35:12 Installed: 32:bind-9.9.4-14.el7.x86_64
Nov 02 14:40:07 Installed: 2:xinetd-2.3.15-12.el7.x86_64
Nov 02 14:40:07 Installed: tftp-server-5.2-11.el7.x86_64
Nov 02 15:20:15 Erased: 32:bind-9.9.4-14.el7.x86_64
Nov 02 15:51:21 Installed: apr-1.4.8-3.el7.x86_64
Nov 02 15:51:21 Installed: apr-util-1.5.2-6.el7.x86_64
Nov 02 15:51:21 Installed: httpd-tools-2.4.6-17.el7.x86_64
Nov 02 15:51:23 Installed: httpd-2.4.6-17.el7.x86_64
Nov 02 15:51:23 Installed: perl-Newt-1.08-36.el7.x86_64
Nov 02 15:51:23 Installed: crypto-utils-2.4.1-42.el7.x86_64
Nov 02 15:51:23 Installed: mod_fcgid-2.3.9-4.el7.x86_64
Nov 02 15:51:24 Installed: httpd-manual-2.4.6-17.el7.noarch
Nov 02 15:51:25 Installed: 1:mod_ssl-2.4.6-17.el7.x86_64
Nov 02 16:26:49 Erased: 1:mod_ssl-2.4.6-17.el7.x86_64
Nov 02 16:26:49 Erased: httpd-manual-2.4.6-17.el7.noarch
Nov 02 16:26:49 Erased: mod_fcgid-2.3.9-4.el7.x86_64
Nov 02 16:26:49 Erased: httpd-2.4.6-17.el7.x86_64
Nov 02 16:26:50 Erased: crypto-utils-2.4.1-42.el7.x86_64
[root@desktop1 ~]# 

19. 使用yum history检查之前的yum操作结果


[root@desktop1 ~]# yum history
Loaded plugins: langpacks
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     6 | root <root>              | 2016-11-02 16:26 | Erase          |    5   
     5 | root <root>              | 2016-11-02 15:51 | Install        |    9   
     4 | root <root>              | 2016-11-02 15:20 | Erase          |    1   
     3 | root <root>              | 2016-11-02 14:40 | Install        |    2   
     2 | root <root>              | 2016-11-02 14:35 | Install        |    1   
     1 | System <unset>           | 2016-09-27 20:12 | Install        | 1236   
history list

20. 执行最近一次 yum 操作的反操作(最近一次是删除 Web Server,所有反操作就是安装 Web Server 组,序号6则是步骤19中的ID6) 

[root@desktop1 ~]# yum history undo 6
Loaded plugins: langpacks
Undoing transaction 6, from Wed Nov  2 16:26:49 2016
    Erase crypto-utils-2.4.1-42.el7.x86_64 @Packages
    Erase httpd-2.4.6-17.el7.x86_64        @Packages
    Erase httpd-manual-2.4.6-17.el7.noarch @Packages
    Erase mod_fcgid-2.3.9-4.el7.x86_64     @Packages
    Erase mod_ssl-1:2.4.6-17.el7.x86_64    @Packages
Resolving Dependencies
--> Running transaction check
---> Package crypto-utils.x86_64 0:2.4.1-42.el7 will be installed
---> Package httpd.x86_64 0:2.4.6-17.el7 will be installed
---> Package httpd-manual.noarch 0:2.4.6-17.el7 will be installed
---> Package mod_fcgid.x86_64 0:2.3.9-4.el7 will be installed
---> Package mod_ssl.x86_64 1:2.4.6-17.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                     Arch                  Version                          Repository               Size
==================================================================================================================
Installing:
 crypto-utils                x86_64                2.4.1-42.el7                     Packages                 78 k
 httpd                       x86_64                2.4.6-17.el7                     Packages                1.2 M
 httpd-manual                noarch                2.4.6-17.el7                     Packages                1.3 M
 mod_fcgid                   x86_64                2.3.9-4.el7                      Packages                 79 k
 mod_ssl                     x86_64                1:2.4.6-17.el7                   Packages                 97 k

Transaction Summary
==================================================================================================================
Install  5 Packages

Total download size: 2.7 M
Installed size: 9.7 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): crypto-utils-2.4.1-42.el7.x86_64.rpm                                                |  78 kB  00:00:00     
(2/5): httpd-2.4.6-17.el7.x86_64.rpm                                                       | 1.2 MB  00:00:00     
(3/5): httpd-manual-2.4.6-17.el7.noarch.rpm                                                | 1.3 MB  00:00:00     
(4/5): mod_fcgid-2.3.9-4.el7.x86_64.rpm                                                    |  79 kB  00:00:00     
(5/5): mod_ssl-2.4.6-17.el7.x86_64.rpm                                                     |  97 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------
Total                                                                             9.6 MB/s | 2.7 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : httpd-2.4.6-17.el7.x86_64                                                                      1/5 
  Installing : mod_fcgid-2.3.9-4.el7.x86_64                                                                   2/5 
  Installing : httpd-manual-2.4.6-17.el7.noarch                                                               3/5 
  Installing : 1:mod_ssl-2.4.6-17.el7.x86_64                                                                  4/5 
  Installing : crypto-utils-2.4.1-42.el7.x86_64                                                               5/5 
  Verifying  : mod_fcgid-2.3.9-4.el7.x86_64                                                                   1/5 
  Verifying  : httpd-manual-2.4.6-17.el7.noarch                                                               2/5 
  Verifying  : crypto-utils-2.4.1-42.el7.x86_64                                                               3/5 
  Verifying  : 1:mod_ssl-2.4.6-17.el7.x86_64                                                                  4/5 
  Verifying  : httpd-2.4.6-17.el7.x86_64                                                                      5/5 

Installed:
  crypto-utils.x86_64 0:2.4.1-42.el7     httpd.x86_64 0:2.4.6-17.el7       httpd-manual.noarch 0:2.4.6-17.el7    
  mod_fcgid.x86_64 0:2.3.9-4.el7         mod_ssl.x86_64 1:2.4.6-17.el7    

Complete!
[root@desktop1 ~]# 

 

Linux功能-使用YUM管理软件包

标签:minimal   tor   virtual   user   efault   man   with   console   tool   

原文地址:http://www.cnblogs.com/tdcqma/p/6023427.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!