在红帽Linux中使用YUM包管理器

系统 Linux
YUM是RHEL系统中提供的一个安装,卸载和搜索软件包的工具。它能做的不仅仅是安装、卸载软件包,它能做的还有更多,下面我们将在本文中为你展示。

[[90082]]

YUM是RHEL系统中提供的一个安装,卸载和搜索软件包的工具。它能做的不仅仅是安装、卸载软件包,它能做的还有更多,下面我们将在本文中为你展示。

YUM可以自动安装软件包的依赖包,例如当你使用yum安装httpd时,它还会自动安装https apache server以及它依赖的软件包。通过rpm软件包安装时就没有这么方便咯(译注:就是不会自动处理软件包依赖问题咯!),你必须下载所有它依赖的软件包,然后依序安装它们。

yum工具从远端服务器上的软件仓库(通常由OS提供商提供)获取软件包的信息。一个软件仓库是能在特定架构上运行的一系列rpm软件包的集合。例如,对于32位和64位系统各有一个软件仓库,还有针对RHEL5以及RHEL6的软件仓库。你也可以建立一个本地仓库,配置你的yum让其从你的本地仓库里搜索安装软件包。在接下来的例子中,我将向你展示除了安装和卸载软件,yum还可以做的其它事情。为方便理解,我将在我的Amazon EC2 RHEL 6.4服务器上使用httpd软件包为例。


从软件仓库里搜索软件包

  1. # yum search httpd 
  2.  
  3. Loaded plugins: amazon-id, rhui-lb, security 
  4. ==================== N/S Matched: httpd ========== 
  5. httpd.x86_64 : Apache HTTP Server 
  6. httpd-devel.i686 : Development interfaces for the Apache HTTP server 
  7. httpd-devel.x86_64 : Development interfaces for the Apache HTTP server 
  8. httpd-manual.noarch : Documentation for the Apache HTTP server 
  9. httpd-tools.x86_64 : Tools for use with the Apache HTTP Server 
  10. mod_dav_svn.x86_64 : Apache httpd module for Subversion server 
  11. mod_dnssd.x86_64 : An Apache HTTPD module which adds Zeroconf support 

想获得详细的输出信息,可以使用下面的命令:

  1. # yum provides httpd 
  2.  
  3. Loaded plugins: amazon-id, rhui-lb, security 
  4. httpd-2.2.15-26.el6.x86_64 : Apache HTTP Server 
  5. Repo : rhui-REGION-rhel-server-releases 
  6. Matched from: 

yum provides httpd在软件仓库里搜索含有httpd的软件包。


提供所有软件组列表

  1. # yum grouplist 

以上命令将为你显示已经安装的以及可用的软件组。你可以使用软件组安装选项来安装其中一个软件组。例如,我们将安装一个PHP Support的软件组。这个软件组内包含需要的PHP软件包。

  1. # yum groupinstall PHP Support 
  2.  
  3. Loaded plugins: amazon-id, downloadonly, rhui-lb, security 
  4. Setting up Group Process 
  5. Warning: Group Support does not exist. 
  6. Resolving Dependencies 
  7. -> Running transaction check 
  8. --> Package php.x86_64 0:5.3.3-23.el6_4 will be installed 
  9. -> Processing Dependency: php-common(x86-64) = 5.3.3-23.el6_4 for package: php-5.3.3-23.el6_4.x86_64 
  10. -> Processing Dependency: php-cli(x86-64) = 5.3.3-23.el6_4 for package: php-5.3.3-23.el6_4.x86_64 
  11. --> Package php-gd.x86_64 0:5.3.3-23.el6_4 will be installed 
  12. -> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.3.3-23.el6_4.x86_64 
  13. --> Package php-pdo.x86_64 0:5.3.3-23.el6_4 will be installed 
  14. --> Package php-pear.noarch 1:1.9.4-4.el6 will be installed 
  15. --> Package php-xml.x86_64 0:5.3.3-23.el6_4 will be installed 
  16. -> Running transaction check 
  17. --> Package libXpm.x86_64 0:3.5.10-2.el6 will be installed 
  18. --> Package php-cli.x86_64 0:5.3.3-23.el6_4 will be installed 
  19. --> Package php-common.x86_64 0:5.3.3-23.el6_4 will be installed 
  20. -> Finished Dependency Resolution 
  21.  
  22. Dependencies Resolved 
  23.  
  24. ================================================== 
  25. Package Arch Version Repository Size 
  26. ================================================== 
  27. Installing: 
  28. php x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 1.1 M 
  29. php-gd x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 106 k 
  30. php-pdo x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 75 k 
  31. php-pear noarch 1:1.9.4-4.el6 rhui-REGION-rhel-server-releases 393 k 
  32. php-xml x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 103 k 
  33. Installing for dependencies: 
  34. libXpm x86_64 3.5.10-2.el6 rhui-REGION-rhel-server-releases 51 k 
  35. php-cli x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 2.2 M 
  36. php-common x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 524 k 
  37.  
  38. Transaction Summary 
  39. ================================================== 
  40. Install 8 Package(s) 
  41.  
  42. Total download size: 4.5 M 
  43. Installed size: 16 M 
  44. Is this ok [y/N]: y 
  45.  
  46. Downloading Packages: 
  47. (1/8): libXpm-3.5.10-2.el6.x86_64.rpm | 51 kB 00:00 
  48. (2/8): php-5.3.3-23.el6_4.x86_64.rpm | 1.1 MB 00:00 
  49. (3/8): php-cli-5.3.3-23.el6_4.x86_64.rpm | 2.2 MB 00:00 
  50. (4/8): php-common-5.3.3-23.el6_4.x86_64.rpm | 524 kB 00:00 
  51. (5/8): php-gd-5.3.3-23.el6_4.x86_64.rpm | 106 kB 00:00 
  52. (6/8): php-pdo-5.3.3-23.el6_4.x86_64.rpm | 75 kB 00:00 
  53. (7/8): php-pear-1.9.4-4.el6.noarch.rpm | 393 kB 00:00 
  54. (8/8): php-xml-5.3.3-23.el6_4.x86_64.rpm | 103 kB 00:00 
  55. ----------------------------------------------- 
  56. Total 2.9 MB/s | 4.5 MB 00:01 
  57. Running rpm_check_debug 
  58. Running Transaction Test 
  59. Transaction Test Succeeded 
  60. Running Transaction 
  61. Installing : php-common-5.3.3-23.el6_4.x86_64 1/8 
  62. Installing : php-cli-5.3.3-23.el6_4.x86_64 2/8 
  63. Installing : libXpm-3.5.10-2.el6.x86_64 3/8 
  64. Installing : php-gd-5.3.3-23.el6_4.x86_64 4/8 
  65. Installing : 1:php-pear-1.9.4-4.el6.noarch 5/8 
  66. Installing : php-5.3.3-23.el6_4.x86_64 6/8 
  67. Installing : php-xml-5.3.3-23.el6_4.x86_64 7/8 
  68. Installing : php-pdo-5.3.3-23.el6_4.x86_64 8/8 
  69. Verifying : 1:php-pear-1.9.4-4.el6.noarch 1/8 
  70. Verifying : php-xml-5.3.3-23.el6_4.x86_64 2/8 
  71. Verifying : php-common-5.3.3-23.el6_4.x86_64 3/8 
  72. Verifying : libXpm-3.5.10-2.el6.x86_64 4/8 
  73. Verifying : php-cli-5.3.3-23.el6_4.x86_64 5/8 
  74. Verifying : php-5.3.3-23.el6_4.x86_64 6/8 
  75. Verifying : php-pdo-5.3.3-23.el6_4.x86_64 7/8 
  76. Verifying : php-gd-5.3.3-23.el6_4.x86_64 8/8 
  77.  
  78. Installed: 
  79. php.x86_64 0:5.3.3-23.el6_4 php-gd.x86_64 0:5.3.3-23.el6_4 php-pdo.x86_64 0:5.3.3-23.el6_4 
  80. php-pear.noarch 1:1.9.4-4.el6 php-xml.x86_64 0:5.3.3-23.el6_4 
  81.  
  82. Dependency Installed: 
  83. libXpm.x86_64 0:3.5.10-2.el6 php-cli.x86_64 0:5.3.3-23.el6_4 php-common.x86_64 0:5.3.3-23.el6_4 
  84.  
  85. Complete! 

使用YUM安装软件包

可以使用yum install命令安装软件包,如下所示:

  1. #  yum install httpd 
  2.  
  3. Loaded plugins: amazon-id, rhui-lb, security 
  4. Setting up Install Process 
  5. Resolving Dependencies 
  6. -> Running transaction check 
  7. --> Package httpd.x86_64 0:2.2.15-29.el6_4 will be installed 
  8. -> Processing Dependency: httpd-tools = 2.2.15-29.el6_4 for package: httpd-2.2.15-29.el6_4.x86_64 
  9. -> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-29.el6_4.x86_64 
  10. -> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.2.15-29.el6_4.x86_64 
  11. -> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.2.15-29.el6_4.x86_64 
  12. -> Running transaction check 
  13. --> Package apr.x86_64 0:1.3.9-5.el6_2 will be installed 
  14. --> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed 
  15. --> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed 
  16. --> Package httpd-tools.x86_64 0:2.2.15-29.el6_4 will be installed 
  17. -> Finished Dependency Resolution 
  18.  
  19. Dependencies Resolved 
  20.  
  21. ====================================================== 
  22. Package Arch Version Repository Size 
  23. ====================================================== 
  24. Installing: 
  25. httpd x86_64 2.2.15-29.el6_4 rhui-REGION-rhel-server-releases 821 k 
  26. Installing for dependencies: 
  27. apr x86_64 1.3.9-5.el6_2 rhui-REGION-rhel-server-releases 123 k 
  28. apr-util x86_64 1.3.9-3.el6_0.1 rhui-REGION-rhel-server-releases 87 k 
  29. apr-util-ldap x86_64 1.3.9-3.el6_0.1 rhui-REGION-rhel-server-releases 15 k 
  30. httpd-tools x86_64 2.2.15-29.el6_4 rhui-REGION-rhel-server-releases 73 k 
  31.  
  32. Transaction Summary 
  33. ====================================================== 
  34. Install 5 Package(s) 
  35.  
  36. Total download size: 1.1 M 
  37. Installed size: 3.6 M 
  38. Is this ok [y/N]: y 

如你所见,在安装httpd时yum安装了额外的软件包。这称为yum完成的依赖包解析。

假如你不想让yum弹出[y/N]选项,可以使用yum install -y httpd


使用yum update 命令更新一个已存在的软件包

  1. # yum update httpd 
  2. Loaded plugins: amazon-id, rhui-lb, security 
  3. Setting up Update Process 
  4. No Packages marked for Update 

这意味着你系统中安装的httpd软件包已经是yum软件仓库里的最新版本的了。


更新服务器上所有的软件包

  1. # yum update 

以上命令将系统上的所有软件包更新到最新版本,包括内核软件包,这意味着你的OS更新到了RHEL提供的最新版本了。


下载RPM软件包但是不安装

可以使用yum从RHEL或者CentOS的软件仓库里下载RPM软件包但是不安装。你首先需要下载一个插件让yum只下载rpm软件包而不安装。插件名字叫downloadonly,可以通过yum安装,如下所示:

  1. # yum install yum-downloadonly 
  2. Loaded plugins: amazon-id, rhui-lb, security 
  3. Setting up Install Process 
  4. Resolving Dependencies 
  5. -> Running transaction check 
  6. --> Package yum-plugin-downloadonly.noarch 0:1.1.30-14.el6 will be installed 
  7. -> Finished Dependency Resolution 
  8.  
  9. Dependencies Resolved 
  10.  
  11. ==================================================== 
  12. Package Arch Version Repository Size 
  13. ==================================================== 
  14. Installing: 
  15. yum-plugin-downloadonly noarch 1.1.30-14.el6 rhui-REGION-rhel-server-releases 20 k 
  16.  
  17. Transaction Summary 
  18. ==================================================== 
  19. Install 1 Package(s) 
  20.  
  21. Total download size: 20 k 
  22. Installed size: 21 k 
  23. Is this ok [y/N]: y 
  24. Downloading Packages: 
  25. yum-plugin-downloadonly-1.1.30-14.el6.noarch.rpm | 20 kB 00:00 
  26. Running rpm_check_debug 
  27. Running Transaction Test 
  28. Transaction Test Succeeded 
  29. Running Transaction 
  30. Installing : yum-plugin-downloadonly-1.1.30-14.el6.noarch 1/1 
  31. Verifying : yum-plugin-downloadonly-1.1.30-14.el6.noarch 1/1 
  32.  
  33. Installed: 
  34. yum-plugin-downloadonly.noarch 0:1.1.30-14.el6 
  35.  
  36. Complete! 

现在你就可以从软件仓库里只下载软件包而不安装了,命令如下:

  1. # yum install httpd-devel -downloadonly 

默认情况下软件包会被下载到/var/cache/yum/目录,但是你可以添加额外选项将其下载到指定位置

  1. # yum install httpd-devel -downloadonly -downloaddir=/opt 

假如你有一个rpm软件包但是没有它所依赖的软件包,你不知道到哪去得到它所依赖的软件包。你仍然可以通过yum安装这个rpm软件包,并从软件仓库里得到它所依赖的软件包。让我们安装刚刚下载的httpd-devel-2.2.15-29.el64.x8664 RPM软件包。

  1. # yum localinstall /opt/httpd-devel-2.2.15-29.el6_4.x86_64.rpm 
  2.  
  3. Loaded plugins: amazon-id, downloadonly, rhui-lb, security 
  4. Setting up Local Package Process 
  5. Examining /opt/httpd-devel-2.2.15-29.el6_4.x86_64.rpm: httpd-devel-2.2.15-29.el6_4.x86_64 
  6. Marking /opt/httpd-devel-2.2.15-29.el6_4.x86_64.rpm to be installed 
  7. Resolving Dependencies 
  8. -> Running transaction check 
  9. --> Package httpd-devel.x86_64 0:2.2.15-29.el6_4 will be installed 
  10. -> Processing Dependency: apr-devel for package: httpd-devel-2.2.15-29.el6_4.x86_64 
  11. -> Processing Dependency: apr-util-devel for package: httpd-devel-2.2.15-29.el6_4.x86_64 
  12. -> Running transaction check 
  13. --> Package apr-devel.x86_64 0:1.3.9-5.el6_2 will be installed 
  14. --> Package apr-util-devel.x86_64 0:1.3.9-3.el6_0.1 will be installed 
  15. -> Processing Dependency: openldap-devel for package: apr-util-devel-1.3.9-3.el6_0.1.x86_64 
  16. -> Processing Dependency: expat-devel for package: apr-util-devel-1.3.9-3.el6_0.1.x86_64 
  17. -> Processing Dependency: db4-devel for package: apr-util-devel-1.3.9-3.el6_0.1.x86_64 
  18. -> Running transaction check 
  19. --> Package db4-devel.x86_64 0:4.7.25-18.el6_4 will be installed 
  20. -> Processing Dependency: db4-cxx = 4.7.25-18.el6_4 for package: db4-devel-4.7.25-18.el6_4.x86_64 
  21. -> Processing Dependency: db4 = 4.7.25-18.el6_4 for package: db4-devel-4.7.25-18.el6_4.x86_64 
  22. -> Processing Dependency: libdb_cxx-4.7.so()(64bit) for package: db4-devel-4.7.25-18.el6_4.x86_64 
  23. --> Package expat-devel.x86_64 0:2.0.1-11.el6_2 will be installed 
  24. --> Package openldap-devel.x86_64 0:2.4.23-32.el6_4.1 will be installed 
  25. -> Processing Dependency: cyrus-sasl-devel >= 2.1 for package: openldap-devel-2.4.23-32.el6_4.1.x86_64 
  26. -> Running transaction check 
  27. --> Package cyrus-sasl-devel.x86_64 0:2.1.23-13.el6_3.1 will be installed 
  28. --> Package db4.x86_64 0:4.7.25-17.el6 will be updated 
  29. -> Processing Dependency: db4 = 4.7.25-17.el6 for package: db4-utils-4.7.25-17.el6.x86_64 
  30. --> Package db4.x86_64 0:4.7.25-18.el6_4 will be an update 
  31. --> Package db4-cxx.x86_64 0:4.7.25-18.el6_4 will be installed 
  32. -> Running transaction check 
  33. --> Package db4-utils.x86_64 0:4.7.25-17.el6 will be updated 
  34. --> Package db4-utils.x86_64 0:4.7.25-18.el6_4 will be an update 
  35. -> Finished Dependency Resolution 
  36.  
  37. Dependencies Resolved 
  38.  
  39. =================================================== 
  40. Package Arch Version Repository Size 
  41. =================================================== 
  42. Installing: 
  43. httpd-devel x86_64 2.2.15-29.el6_4 /httpd-devel-2.2.15-29.el6_4.x86_64 526 k 
  44. Installing for dependencies: 
  45. apr-devel x86_64 1.3.9-5.el6_2 rhui-REGION-rhel-server-releases 176 k 
  46. apr-util-devel x86_64 1.3.9-3.el6_0.1 rhui-REGION-rhel-server-releases 69 k 
  47. cyrus-sasl-devel x86_64 2.1.23-13.el6_3.1 rhui-REGION-rhel-server-releases 302 k 
  48. db4-cxx x86_64 4.7.25-18.el6_4 rhui-REGION-rhel-server-releases 588 k 
  49. db4-devel x86_64 4.7.25-18.el6_4 rhui-REGION-rhel-server-releases 6.6 M 
  50. expat-devel x86_64 2.0.1-11.el6_2 rhui-REGION-rhel-server-releases 120 k 
  51. openldap-devel x86_64 2.4.23-32.el6_4.1 rhui-REGION-rhel-server-releases 1.1 M 
  52. Updating for dependencies: 
  53. db4 x86_64 4.7.25-18.el6_4 rhui-REGION-rhel-server-releases 563 k 
  54. db4-utils x86_64 4.7.25-18.el6_4 rhui-REGION-rhel-server-releases 130 k 
  55.  
  56. Transaction Summary 
  57. =============================================== 
  58. Install 8 Package(s) 
  59. Upgrade 2 Package(s) 
  60.  
  61. Total size: 10 M 
  62. Is this ok [y/N]: y 
  63. Downloading Packages: 
  64. Running rpm_check_debug 
  65. Running Transaction Test 
  66. Transaction Test Succeeded 
  67. Running Transaction 
  68. Updating : db4-4.7.25-18.el6_4.x86_64 1/12 
  69. Installing : apr-devel-1.3.9-5.el6_2.x86_64 2/12 
  70. Installing : expat-devel-2.0.1-11.el6_2.x86_64 3/12 
  71. Installing : db4-cxx-4.7.25-18.el6_4.x86_64 4/12 
  72. Installing : db4-devel-4.7.25-18.el6_4.x86_64 5/12 
  73. Installing : cyrus-sasl-devel-2.1.23-13.el6_3.1.x86_64 6/12 
  74. Installing : openldap-devel-2.4.23-32.el6_4.1.x86_64 7/12 
  75. Installing : apr-util-devel-1.3.9-3.el6_0.1.x86_64 8/12 
  76. Installing : httpd-devel-2.2.15-29.el6_4.x86_64 9/12 
  77. Updating : db4-utils-4.7.25-18.el6_4.x86_64 10/12 
  78. Cleanup : db4-utils-4.7.25-17.el6.x86_64 11/12 
  79. Cleanup : db4-4.7.25-17.el6.x86_64 12/12 
  80. Verifying : apr-devel-1.3.9-5.el6_2.x86_64 1/12 
  81. Verifying : cyrus-sasl-devel-2.1.23-13.el6_3.1.x86_64 2/12 
  82. Verifying : apr-util-devel-1.3.9-3.el6_0.1.x86_64 3/12 
  83. Verifying : db4-cxx-4.7.25-18.el6_4.x86_64 4/12 
  84. Verifying : httpd-devel-2.2.15-29.el6_4.x86_64 5/12 
  85. Verifying : openldap-devel-2.4.23-32.el6_4.1.x86_64 6/12 
  86. Verifying : expat-devel-2.0.1-11.el6_2.x86_64 7/12 
  87. Verifying : db4-devel-4.7.25-18.el6_4.x86_64 8/12 
  88. Verifying : db4-4.7.25-18.el6_4.x86_64 9/12 
  89. Verifying : db4-utils-4.7.25-18.el6_4.x86_64 10/12 
  90. Verifying : db4-4.7.25-17.el6.x86_64 11/12 
  91. Verifying : db4-utils-4.7.25-17.el6.x86_64 12/12 
  92.  
  93. Installed: 
  94. httpd-devel.x86_64 0:2.2.15-29.el6_4 
  95.  
  96. Dependency Installed: 
  97. apr-devel.x86_64 0:1.3.9-5.el6_2 apr-util-devel.x86_64 0:1.3.9-3.el6_0.1 
  98. cyrus-sasl-devel.x86_64 0:2.1.23-13.el6_3.1 db4-cxx.x86_64 0:4.7.25-18.el6_4 
  99. db4-devel.x86_64 0:4.7.25-18.el6_4 expat-devel.x86_64 0:2.0.1-11.el6_2 
  100. openldap-devel.x86_64 0:2.4.23-32.el6_4.1 
  101.  
  102. Dependency Updated: 
  103. db4.x86_64 0:4.7.25-18.el6_4 db4-utils.x86_64 0:4.7.25-18.el6_4 
  104.  
  105. Complete! 

使用yum卸载软件包

使用 yum remove 卸载软件包。举例如下:

  1. # yum remove httpd 
  2. Failed to set locale, defaulting to C 
  3. Loaded plugins: amazon-id, downloadonly, rhui-lb, security 
  4. Setting up Remove Process 
  5. Resolving Dependencies 
  6. -> Running transaction check 
  7. --> Package httpd.x86_64 0:2.2.15-29.el6_4 will be erased 
  8. -> Processing Dependency: httpd-mmn = 20051115 for package: php-5.3.3-23.el6_4.x86_64 
  9. -> Processing Dependency: httpd = 2.2.15-29.el6_4 for package: httpd-devel-2.2.15-29.el6_4.x86_64 
  10. -> Running transaction check 
  11. --> Package httpd-devel.x86_64 0:2.2.15-29.el6_4 will be erased 
  12. --> Package php.x86_64 0:5.3.3-23.el6_4 will be erased 
  13. -> Finished Dependency Resolution 
  14.  
  15. Dependencies Resolved 
  16.  
  17. ================================================ 
  18. Package Arch Version Repository Size 
  19. ================================================ 
  20. Removing: 
  21. httpd x86_64 2.2.15-29.el6_4 @rhui-REGION-rhel-server-releases 2.9 M 
  22. Removing for dependencies: 
  23. httpd-devel x86_64 2.2.15-29.el6_4 @/httpd-devel-2.2.15-29.el6_4.x86_64 526 k 
  24. php x86_64 5.3.3-23.el6_4 @rhui-REGION-rhel-server-releases 3.5 M 
  25.  
  26. Transaction Summary 
  27. ================================================ 
  28. Remove 3 Package(s) 
  29.  
  30. Installed size: 7.0 M 
  31. Is this ok [y/N]: y 
  32. Downloading Packages: 
  33. Running rpm_check_debug 
  34. Running Transaction Test 
  35. Transaction Test Succeeded 
  36. Running Transaction 
  37. Erasing : httpd-devel-2.2.15-29.el6_4.x86_64 1/3 
  38. Erasing : php-5.3.3-23.el6_4.x86_64 2/3 
  39. Erasing : httpd-2.2.15-29.el6_4.x86_64 3/3 
  40. Verifying : httpd-2.2.15-29.el6_4.x86_64 1/3 
  41. Verifying : httpd-devel-2.2.15-29.el6_4.x86_64 2/3 
  42. Verifying : php-5.3.3-23.el6_4.x86_64 3/3 
  43.  
  44. Removed: 
  45. httpd.x86_64 0:2.2.15-29.el6_4 
  46.  
  47. Dependency Removed: 
  48. httpd-devel.x86_64 0:2.2.15-29.el6_4 php.x86_64 0:5.3.3-23.el6_4 
  49.  
  50. Complete! 

列出所有安装的软件包

假如你要列出你系统上安装的所有软件包,你可以使用yum list installed命令。这条命令结合grep命令是非常有用的,可以用来检查某个特定的软件包是否已被安装。这与使用rpm -qa命令询问已经安装的软件包相似。

  1. # yum list installed 
  2. Loaded plugins: amazon-id, downloadonly, rhui-lb, security 
  3. Installed Packages 
  4. ConsoleKit.x86_64 0.4.1-3.el6 @koji-override-0/$releasever 
  5. ConsoleKit-libs.x86_64 0.4.1-3.el6 @koji-override-0/$releasever 
  6. MAKEDEV.x86_64 3.24-6.el6 @koji-override-0/$releasever 
  7. PyYAML.x86_64 3.10-3.1.el6 @koji-override-0/$releasever 
  8. Red_Hat_Enterprise_Linux-Release_Notes-6-en-US.noarch 
  9. 4-2.el6 @koji-override-0/$releasever 
  10. SDL.x86_64 1.2.14-3.el6 @koji-override-0/$releasever 
  11. abrt.x86_64 2.0.8-15.el6 @koji-override-0/$releasever 
  12. abrt-addon-ccpp.x86_64 2.0.8-15.el6 @koji-override-0/$releasever 
  13. abrt-addon-kerneloops.x86_64 2.0.8-15.el6 @koji-override-0/$releasever 
  14. abrt-addon-python.x86_64 2.0.8-15.el6 @koji-override-0/$releasever 
  15. abrt-cli.x86_64 2.0.8-15.el6 @koji-override-0/$releasever 
  16. abrt-libs.x86_64 2.0.8-15.el6 @koji-override-0/$releasever 
  17. abrt-tui.x86_64 2.0.8-15.el6 @koji-override-0/$releasever 
  18. acl.x86_64 2.2.49-6.el6 @koji-override-0/$releasever 
  19. acpid.x86_64 1.0.10-2.1.el6 @koji-override-0/$releasever 
  20. aic94xx-firmware.noarch 30-2.el6 @koji-override-0/$releasever 
  21. Output Truncated. 

列出可用的软件库,通过它们可以查询、安装和更新软件包

  1. # yum repolist 
  2.  
  3. Loaded plugins: amazon-id, downloadonly, rhui-lb, security 
  4. repo id repo name status 
  5. rhui-REGION-client-config-server-6 Red Hat Update Infrastructure 2.0 Client Configuration Server 6 4 
  6. rhui-REGION-rhel-server-releases Red Hat Enterprise Linux Server 6 (RPMs) 10994 
  7. rhui-REGION-rhel-server-releases-optional Red Hat Enterprise Linux Server 6 Optional (RPMs) 6250 
  8. repolist: 17248 

via: http://linoxide.com/linux-command/package-management-yum-redhat-linux/

 

责任编辑:奔跑的冰淇淋 来源: Linux中国
相关推荐

2022-03-21 21:28:00

Homebrew包管理器Linux

2021-12-09 09:27:22

MacOSHomebrew包管理器

2020-06-28 13:56:01

UbuntuAptSynaptic

2022-08-04 14:54:50

APTDNFYUM

2023-04-17 07:36:28

Arch LinuxGUI

2021-07-27 12:58:46

Linux包管理器安命令

2021-02-28 13:26:15

Linux软件包管理器软件仓库

2016-09-12 15:00:46

Linux包管理器新手

2010-01-05 10:14:09

Ubuntu软件包

2021-02-07 09:03:58

Linux Zypper 管理器

2020-03-09 11:43:35

RustCargo编程语言

2020-12-03 12:06:54

HarmonyOS

2022-10-11 16:09:27

系统Linux管理器

2021-11-11 11:13:20

js Npm基础

2009-07-07 09:00:39

2013-09-29 10:14:24

YUM软件包管理Linux YUM

2010-10-08 09:26:17

.NET微软

2010-03-22 09:14:35

Python包管理

2018-08-23 16:51:40

Linux软件仓库包管理器

2010-01-06 16:33:24

Ubuntu软件包
点赞
收藏

51CTO技术栈公众号