YUM软件包管理器

YUM

 

1.简介:... 1

2.yum的基本命令... 1

2.1查询相关... 1

2.2安装... 1

2.2.1卸载... 1

3.软件包组管理... 1

3.1常用命令... 1

3.2软件包组安装... 1

3.3软件包组移除(慎用). 1

4.制作简单的本地YUM... 1

 

 

1.简介:

          YUM(全称为 Yellow dogUpdater, Modified) 是一个在FedoraRedHat以及CentOS中的交互式shell前端默认使用软件包管理器。系统管理员使用YUM可以工作许多的工作量,它可以解决RPM中的一些缺陷(解决软件包的依赖关系),管理亦可自作本地YUM使软件安装部署变得非常简单。

2.yum的基本命令

yum list [available|installed|extras|updates|obsoletes|all|recent] [pkgspec]

2.1查询相关

list :显示系统yum数据库缓存中所有的软件包信息(包名,版本等相关信息)

#yum  list | more

Loaded  plugins: fastestmirror

Loading  mirror speeds from cached hostfile

Installed  Packages

ConsoleKit.i686                        0.4.1-3.el6                        @myyum

ConsoleKit-libs.i686                   0.4.1-3.el6                          @myyum

GConf2.i686                            2.28.0-6.el6                      @myyum

GConf2-devel.i686                      2.28.0-6.el6                       @myyum

MAKEDEV.i686                           3.24-6.el6                         @anaconda-CentOS-201303020136.i386/6.4

ORBit2.i686                             2.14.17-3.2.el6_3                   @myyum

ORBit2-devel.i686                      2.14.17-3.2.el6_3                   @myyum

abrt.i686                               2.0.8-15.el6                        @myyum

abrt-addon-ccpp.i686                   2.0.8-15.el6                        @myyum

yumlist installed (相当于 rpm -qa)已经安装的软件包查询

# yum list installed | more

Loaded  plugins: fastestmirror

Installed  Packages

ConsoleKit.i686         0.4.1-3.el6       @myyum                               

ConsoleKit-libs.i686    0.4.1-3.el6         @myyum                                

GConf2.i686             2.28.0-6.el6     @myyum                               

GConf2-devel.i686       2.28.0-6.el6      @myyum                               

MAKEDEV.i686            3.24-6.el6      @anaconda-CentOS-201303020136.i386/6.4

ORBit2.i686             2.14.17-3.2.el6_3 @myyum                               

ORBit2-devel.i686       2.14.17-3.2.el6_3 @myyum                               

abrt.i686               2.0.8-15.el6      @myyum                                

abrt-addon-ccpp.i686    2.0.8-15.el6      @myyum      

查询某个软件包是否已经安装

#  yum list bash

Loaded  plugins: fastestmirror

Loading  mirror speeds from cached hostfile

Installed  Packages

bash.i686                          4.1.2-14.el6                          @anaconda-CentOS-201303020136.i386/6.4

 

# yum info bash  /*相当于rpm �Cqi查看软件包的一些简介

Loaded  plugins: fastestmirror

Loading  mirror speeds from cached hostfile

Installed  Packages

Name        : bash

Arch        : i686

Version     : 4.1.2

Release     : 14.el6

Size        : 3.0 M

Repo        : installed

From  repo   :  anaconda-CentOS-201303020136.i386

Summary     : The GNU Bourne Again shell

URL         : http://www.gnu.org/software/bash

License     : GPLv3+

Description  : The GNU Bourne Again shell (Bash) is a shell or command language

            : interpreter that is compatible  with the Bourne shell (sh). Bash

            : incorporates useful features  from the Korn shell (ksh) and the C shell

            : (csh). Most sh scripts can be  run by bash without modification.

模糊搜索

# yum search all   ssh

Loaded plugins:  fastestmirror

Loading mirror speeds from  cached hostfile

================================================  Matched: ssh =================================================

libssh2.i686 : A library  implementing the SSH2 protocol

openssh.i686 : An open  source implementation of SSH protocol versions 1 and 2

openssh-askpass.i686 : A  passphrase dialog for OpenSSH and X

openssh-clients.i686 : An  open source SSH client applications

openssh-server.i686 : An  open source SSH server daemon

trilead-ssh2.noarch :  SSH-2 protocol implementation in pure Java

ksshaskpass.i686 : A KDE  version of ssh-askpass with KWallet support

jsch.noarch : Pure Java  implementation of SSH2

python-paramiko.noarch : A  SSH2 protocol library for python

python-twisted-conch.i686  : SSH and SFTP protocol implementation together with clients and servers

kdeutils.i686 : KDE  Utilities

krb5-appl-clients.i686 :  Kerberos-aware telnet, ftp, rcp, rsh and rlogin clients

krb5-appl-servers.i686 :  Kerberos-aware telnet, ftp, rcp, rsh and rlogin servers

pexpect.noarch  : Pure Python Expect-like module

 

2.2安装

 

yuminstall 软件包名  -y

#  yum install  -y lrzsz

Loaded  plugins: fastestmirror

Loading  mirror speeds from cached hostfile

Setting  up Install Process

Resolving  Dependencies

-->  Running transaction check

--->  Package lrzsz.i686 0:0.12.20-27.1.el6 will be installed

-->  Finished Dependency Resolution

 

Dependencies  Resolved

 

===============================================================================================================

 Package                Arch                  Version                             Repository              Size

===============================================================================================================

Installing:

 lrzsz                  i686                  0.12.20-27.1.el6                    myyum                   66 k

 

Transaction  Summary

===============================================================================================================

Install       1 Package(s)

 

Total  download size: 66 k

Installed  size: 150 k

Downloading  Packages:

Running  rpm_check_debug

Running  Transaction Test

Transaction  Test Succeeded

Running  Transaction

  Installing :  lrzsz-0.12.20-27.1.el6.i686                                                                  1/1

  Verifying   : lrzsz-0.12.20-27.1.el6.i686                                                                  1/1

 

Installed:

  lrzsz.i686 0:0.12.20-27.1.el6                                                                                 

 

Complete!

2.2.1卸载

#  yum remove  -y   lrzsz

Loaded  plugins: fastestmirror

Setting  up Remove Process

Resolving  Dependencies

-->  Running transaction check

--->  Package lrzsz.i686 0:0.12.20-27.1.el6 will be erased

-->  Finished Dependency Resolution

 

Dependencies  Resolved

 

===============================================================================================================

 Package                Arch                  Version                            Repository               Size

===============================================================================================================

Removing:

 lrzsz                  i686                  0.12.20-27.1.el6                   @myyum                  150 k

 

Transaction  Summary

===============================================================================================================

Remove        1 Package(s)

 

Installed  size: 150 k

Downloading  Packages:

Running  rpm_check_debug

Running  Transaction Test

Transaction  Test Succeeded

Running  Transaction

  Erasing     : lrzsz-0.12.20-27.1.el6.i686                                                                  1/1

  Verifying   : lrzsz-0.12.20-27.1.el6.i686                                                                  1/1

 

Removed:

  lrzsz.i686 0:0.12.20-27.1.el6                                                                                 

 

Complete!

3.软件包组管理

3.1常用命令

和单个软件包差异不大

yum  grouplist

yum  groupinfo

yum  groupinstall

yum  groupupdate

yum  groupremove

 

###########查询包组###########

#  yum grouplist

Loaded  plugins: fastestmirror

Setting  up Group Process

Loading  mirror speeds from cached hostfile

myyum/group_gz                                                                           | 204 kB     00:00 ...

Installed  Groups:

   CIFS 文件服务器

   Java 平台

   MySQL 数据库客户端

   MySQL 数据库服务器

   PHP 支持

   Perl 支持

   PostgreSQL 数据库客户端

   Ruby 支持

   SNMP 支持

   万维网服务器

   兼容程序库

   图形管理工具

   字体

   安全性工具

   开发工具

   电子邮件服务器

   目录客户端

   目录服务器

   硬件监控工具

   系统管理工具

   继承 UNIX 兼容性

   继承 X Windows 系统的兼容性

   网络基础设施服务器

   网络文件系统客户端

   调试工具

   通用桌面

   附加开发

Installed  Language Groups:

   阿拉伯语支持 [ar]

Available  Groups:

   Eclipse

   Emacs

   FCoE 存储客户端

   FTP 服务器

   Infiniband 支持

   KDE 桌面

   NFS 文件服务器

   PostgreSQL 数据库服务器

   TeX 支持

   TurboGear 应用程序框架

   Web 服务器程序引擎

   X 窗口系统

   iSCSI 存储客户端

   主框架访问

   互联网浏览器

   图形生成工具

   基于网页的企业级管理

   基本

   备份客户端

   备份服务器

   大系统性能

   存储可用性工具

   客户端管理工具

   性能工具

   打印客户端

   打印服务器

   拨号网络支持

   控制台互联网工具

   智能卡支持

   服务器平台

   服务器平台开发

   桌面

   桌面平台

   桌面平台开发

   桌面调试和运行工具

   短信客户端支持

   科学记数法支持

   科技写作

   系统管理

   系统管理消息服务器支持

   网络存储服务器

   联网工具

   虚拟化

   虚拟化客户端

   虚拟化工具

   虚拟化平台

   身份管理服务器

   输入法

   远程桌面客户端

Available  Language Groups:

   上索布语支持 [hsb]

   不丹语支持 [dz]

   世界语支持 [eo]

   中文支持 [zh]

   丹麦语支持 [da]

   乌克兰语支持 [uk]

   乌兹别克语支持 [uz]

   乌尔都语支持 [ur]

   亚美尼亚语支持 [hy]

   伊努伊特语支持 [iu]

   低地撒克逊语支持 [nds]

3.2软件包组安装

#  yum groupinstall -y "开发工具"

Loaded  plugins: fastestmirror

Loading  mirror speeds from cached hostfile

Setting  up Group Process

Loading  mirror speeds from cached hostfile

Resolving  Dependencies

-->  Running transaction check

--->  Package autoconf.noarch 0:2.63-5.1.el6 will be installed

--->  Package automake.noarch 0:1.11.1-4.el6 will be installed

--->  Package binutils.i686 0:2.20.51.0.2-5.36.el6 will be installed

--->  Package bison.i686 0:2.4.1-5.el6 will be installed

--->  Package byacc.i686 0:1.9.20070509-7.el6 will be installed

--->  Package cscope.i686 0:15.6-6.el6 will be installed

…                  …..                   ….               ….

 

===============================================================================================================

 Package                        Arch                Version                           Repository          Size

===============================================================================================================

Installing:

 autoconf                       noarch              2.63-5.1.el6                      myyum              781 k

 automake                       noarch              1.11.1-4.el6                      myyum              550 k

 binutils                       i686                2.20.51.0.2-5.36.el6              myyum              2.8 M

 bison                          i686                2.4.1-5.el6                       myyum              626 k

 byacc                          i686                1.9.20070509-7.el6                myyum               44 k

 cscope                         i686                15.6-6.el6                        myyum              130 k

 ctags                          i686                5.8-2.el6                         myyum              142 k

 cvs                            i686                1.11.23-15.el6                    myyum              699 k

 diffstat                       i686                1.51-2.el6                        myyum               29 k

 doxygen                        i686                1:1.6.1-6.el6                     myyum              2.3 M

 elfutils                       i686                0.152-1.el6                       myyum              214 k

 flex                           i686                2.5.35-8.el6                      myyum              279 k

 gcc                             i686                4.4.7-3.el6                       myyum              8.2 M

 gcc-c++                        i686                4.4.7-3.el6                       myyum              4.3 M

 gcc-gfortran                   i686                4.4.7-3.el6                       myyum              4.1 M

 gettext                        i686                0.17-16.el6                       myyum              1.8 M

 git                            i686                1.7.1-2.el6_0.1                   myyum              4.5 M

 indent                         i686                2.2.10-7.el6                      myyum              112 k

 intltool                       noarch              0.41.0-1.1.el6                    myyum               58 k

 libtool                        i686                2.2.6-15.5.el6                    myyum              564 k

 make                           i686                1:3.81-20.el6                     myyum              386 k

 patch                          i686                2.6-6.el6                         myyum               96 k

 patchutils                     i686                0.3.1-3.1.el6                     myyum               94 k

 pkgconfig                      i686                1:0.23-9.1.el6                    myyum               67 k

 rcs                            i686                5.7-37.el6                        myyum              169 k

 redhat-rpm-config              noarch              9.0.3-42.el6                      myyum               59 k

 rpm-build                      i686                4.8.0-32.el6                      myyum              127 k

 subversion                     i686                1.6.11-7.el6                      myyum              2.2 M

 swig                           i686                1.3.40-6.el6                      myyum              1.1 M

 systemtap                      i686                1.8-7.el6                         myyum               26 k

Installing  for dependencies:

 gettext-devel                  i686                0.17-16.el6                       myyum              153 k

 hwdata                         noarch              0.233-7.9.el6                     myyum              1.1 M

 initscripts                    i686                9.03.38-1.el6                     myyum              937 k

 iproute                        i686                2.6.32-23.el6                     myyum              342 k

 iptables                       i686                1.4.7-9.el6                       myyum              246 k

 iputils                        i686                20071127-16.el6                   myyum              118 k

 module-init-tools              i686                3.9-21.el6                        myyum              452 k

 openssh                        i686                5.3p1-84.1.el6                    myyum              237 k

 openssh-clients                i686                5.3p1-84.1.el6                    myyum              360 k

 perl-Git                       noarch              1.7.1-2.el6_0.1                   myyum               28 k

 policycoreutils                i686                2.0.83-19.30.el6                  myyum              672 k

 systemtap-client               i686                1.8-7.el6                         myyum              3.2 M

 systemtap-devel                i686                1.8-7.el6                         myyum              1.2 M

 udev                           i686                147-2.46.el6                      myyum              355 k

 util-linux-ng                  i686                2.17.2-12.9.el6                   myyum              1.5 M

 

Transaction  Summary

===============================================================================================================

Install      45 Package(s)

 

Total  download size: 47 M

Installed  size: 143 M

Downloading  Packages:

---------------------------------------------------------------------------------------------------------------

Total                                                                            14 MB/s |  47 MB     00:03      

Running  rpm_check_debug

Running  Transaction Test

Transaction  Test Succeeded

Running  Transaction

 

 

3.3软件包组移除(慎用)

#  yum groupremove -y  "开发工具"

Loaded  plugins: fastestmirror

Setting  up Group Process

Loading  mirror speeds from cached hostfile

Resolving  Dependencies

-->  Running transaction check

--->  Package autoconf.noarch 0:2.63-5.1.el6 will be erased

-->  Processing Dependency: autoconf for package: php-devel-5.3.3-22.el6.i686

--->  Package automake.noarch 0:1.11.1-4.el6 will be erased

-->  Processing Dependency: automake for package:  ORBit2-devel-2.14.17-3.2.el6_3.i686

-->  Processing Dependency: automake for package: libcurl-devel-7.19.7-35.el6.i686

-->  Processing Dependency: automake for package: gtk-doc-1.11-5.1.el6.noarch

-->  Processing Dependency: automake for package: GConf2-devel-2.28.0-6.el6.i686

-->  Processing Dependency: automake for package:  gnome-doc-utils-0.18.1-1.el6.noarch

-->  Processing Dependency: automake for package: gtk2-devel-2.18.9-12.el6.i686

--->  Package binutils.i686 0:2.20.51.0.2-5.36.el6 will be erased

-->  Processing Dependency: binutils for package: crash-6.1.0-1.el6.i686

-->  Processing Dependency: binutils for package:  module-init-tools-3.9-21.el6.i686

--->  Package bison.i686 0:2.4.1-5.el6 will be erased

--->  Package byacc.i686 0:1.9.20070509-7.el6 will be erased

--->  Package cmake.i686 0:2.6.4-5.el6 will be erased

--->  Package cscope.i686 0:15.6-6.el6 will be erased

--->  Package ctags.i686 0:5.8-2.el6 will be erased

--->  Package cvs.i686 0:1.11.23-15.el6 will be erased

--->  Package diffstat.i686 0:1.51-2.el6 will be erased

--->  Package doxygen.i686 1:1.6.1-6.el6 will be erased

--->  Package elfutils.i686 0:0.152-1.el6 will be erased

-->  Processing Dependency: elfutils for package:  abrt-addon-ccpp-2.0.8-15.el6.i686

--->  Package flex.i686 0:2.5.35-8.el6 will be erased

--->  Package gcc.i686 0:4.4.7-3.el6 will be erased

-->  Processing Dependency: gcc for package: systemtap-devel-1.8-7.el6.i686

-->  Processing Dependency: gcc for package: systemtap-devel-1.8-7.el6.i686

--->  Package gcc-c++.i686 0:4.4.7-3.el6 will be erased

--->  Package gcc-gfortran.i686 0:4.4.7-3.el6 will be erased

--->  Package gettext.i686 0:0.17-16.el6 will be erased

-->  Processing Dependency: libgettextlib-0.17.so for package:  gettext-devel-0.17-16.el6.i686

-->  Processing Dependency: libgettextsrc-0.17.so for package:  gettext-devel-0.17-16.el6.i686

-->  Processing Dependency: gettext = 0.17-16.el6 for package:  gettext-devel-0.17-16.el6.i686

-->  Processing Dependency: gettext for package: rrdtool-1.4.7-1.el6.rfx.i686

--->  Package git.i686 0:1.7.1-2.el6_0.1 will be erased

-->  Processing Dependency: git = 1.7.1-2.el6_0.1 for package:  perl-Git-1.7.1-2.el6_0.1.noarch

--->  Package indent.i686 0:2.2.10-7.el6 will be erased

--->  Package intltool.noarch 0:0.41.0-1.1.el6 will be erased

--->  Package jpackage-utils.noarch 0:1.7.5-3.12.el6 will be erased

………………………………………………………

Dependency  Removed:

  GConf2-devel.i686 0:2.28.0-6.el6                                                                              

net-snmp.i686 1:5.5-44.el6                                                                                    

  net-snmp-devel.i686 1:5.5-44.el6                                                                             

      …….          ……..      ……..                                                  

xorg-x11-font-utils.i686 1:7.2-11.el6                                                                        

  xorg-x11-fonts-Type1.noarch  0:7.2-9.1.el6                                                                     

  xorg-x11-proto-devel.noarch  0:7.6-25.el6                                                                      

  zlib-devel.i686 0:1.2.3-29.el6                                                                                

 

Complete!

4.制作简单的本地YUM

#cd  /etc/yum.repo.d/

将此目录下所有文件打包备份,或者重命名不以.repo结尾

 

#  cat >/etc/yum.repos.d/myyum.repo <<EOF

>  [zrdyum]

>  name=zrdyum

>  baseurl=file:///yum

>  enabled=1

>  gpgcheck=0

> EOF

#  cat /etc/yum.repos.d/myyum.repo

[zrdyum]

name=zrdyum

baseurl=file:///yum

enabled=1*

gpgcheck=0

 

#mkdr /yum

#mount �Co loop /dev/sr0  /yum    /*光盘已经链接为前提

#  yum clean all   /*清除原来yum数据库的相关信息

Loaded  plugins: fastestmirror

Cleaning  repos: zrdyum

Cleaning  up Everything

Cleaning up list of fastest mirrors

#  yum update    /*重新生成yum数据库信息

Loaded  plugins: fastestmirror

Determining  fastest mirrors

zrdyum             | 3.9 kB     00:00 ...                                                                              

zrdyum/primary_db   | 2.5 MB     00:00 ...                                                                       

Setting  up Update Process

No Packages marked for Update

#yum  list  /*查看yum是否能正常使用

Loaded  plugins: fastestmirror

Loading  mirror speeds from cached hostfile

Installed  Packages

ConsoleKit.i686          0.4.1-3.el6                        @myyum

ConsoleKit-libs.i686       0.4.1-3.el6                        @myyum

GConf2.i686             2.28.0-6.el6                       @myyum

 


你可能感兴趣的:(数据库,软件包,Yellow,系统管理员,工作量)