Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1727612
  • 博文数量: 42
  • 博客积分: 10036
  • 博客等级: 上将
  • 技术积分: 2285
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-18 17:08
文章存档

2011年(3)

2010年(3)

2009年(5)

2008年(31)

分类: LINUX

2008-07-22 11:49:57

Read the f*king Manuals:
yum是一个交互式的,基于rpm的软件包管理器。它自动执行系统更新,包括依赖性分析和淘汰陈旧的包,依据就是称之为“仓库”的元数据。
它可以执行安装新软件、移除旧的和查询已经安装的或是可以获得的,当然还有更多的功能,请往下看:。
yum和其他诸如apt-get、smart等高级的包管理很相似。
       command is one of:
        * install package1 [package2] [...]        安装
        * update [package1] [package2] [...]       更新
        * check-update                                检查更新
        * upgrade [package1] [package2] [...]          发行版升级
        * remove | erase package1 [package2] [...]      删除
        * list [...]                                            列表
        * info [...]                                        信息
        * provides | whatprovides feature1 [feature2] [...]       提供的特征?
        * clean [ packages | headers | metadata | dbcache | all ]          清除缓存
        * makecache                                         建立缓存
        * groupinstall group1 [group2] [...]                   软件包组安装
        * groupupdate group1 [group2] [...]                   组更新
        * grouplist [hidden]                                     组列表
        * groupremove group1 [group2] [...]                   组删除
        * groupinfo group1 [...]                                  组信息
        * search string1 [string2] [...]                           关键字搜索
        * shell [filename]                                        一个交互式的操作环境
        * resolvedep dep1 [dep2] [...]                          解决依赖性
        * localinstall rpmfile1 [rpmfile2] [...]                     本地安装 (相对于网络下载)
        * localupdate rpmfile1 [rpmfile2] [...]                      本地更新
        * deplist package1 [package2] [...]                        列出依赖相关
        * repolist [all|enabled|disabled]                            仓库列表
        * help [command]                                          帮助。

个人喜好的缘故,喜欢纯粹的环境,就像python交互式编程,就像操作LVM一样,喜欢进入它自己的shell里一样,仍然倾向于yum shell.
下面就个人的一些操作来作一番试验:
[root@anaconda color-theme-6.6.0]# yum shell
Loaded plugins: fastestmirror, refresh-packagekit
Setting up Yum Shell
> info
Loading mirror speeds from cached hostfile
 * livna: livna.cat.pdx.edu
 * fedora: ftp.cse.yzu.edu.tw
 * adobe-linux-i386: linuxdownload.adobe.com
 * updates: ftp.cse.yzu.edu.tw
 * freshrpms: ayo.ie.freshrpms.net
livna                                                    | 2.1 kB     00:00   
fedora                                                   | 2.4 kB     00:00   
 .........................
Name       : zsh-html
Arch       : i386
Version    : 4.3.4
Release    : 8.fc9
Size       : 406 k
Repo       : updates
Summary    : HTML 格式的 Zsh shell 手册
URL        :
License    : BSD
Description: zsh shell 是一个命令解释器,可以用作一个互动的 登录 shell,也可以用作一个 shell 脚本命令处理器。 Zsh 与 ksh shell (Korn shell)
           : 相似,但是包括更多改 进。Zsh 支持命令行编辑;内建拼写订正;可编程的 命令补全;shell 函数 (带自动载入);一个历史机 制;等等。  这个软件包含有 html 格式的 Zsh 手册。

................................
> grouplist
Setting up Group Process
Loading mirror speeds from cached hostfile
 * livna: livna.cat.pdx.edu
 * fedora: ftp.cse.yzu.edu.tw
 * adobe-linux-i386: linuxdownload.adobe.com
 * updates: ftp.cse.yzu.edu.tw
 * freshrpms: ayo.ie.freshrpms.net
Installed Groups:
   Base (RPM Fusion Free)
   Base (RPM Fusion Nonfree)
   Fedora Eclipse
   Miscellaneous command line tools (RPM Fusion Free)
   Sound and Video (RPM Fusion Free)
Available Groups:
   Games and Entertainment (RPM Fusion Free)
   Fedora Packager
   SUGAR Desktop Environment
   Xine
   XFCE
   Games and Entertainment (RPM Fusion Nonfree)
   Hardware Support (RPM Fusion Free)
   KDE (K Desktop Environment) (RPM Fusion Free)
   Hardware Support (RPM Fusion Nonfree)
   MPlayer
   GNOME Desktop Environment (RPM Fusion Free)
   Internet (RPM Fusion Free)
   System Tools (RPM Fusion Free)
如果忘记了什么,请键入help查看帮助文档。

至于yum.conf文件,是yum在执行所读取的全局配置文件,分两块内容,一是main,另外一是 repository,main定义了全局的配置属性,且
必须只有一个main的段落。repository定义了每一个repository/server,允许有一个和多个repository的定义,也可以使用include=path_to_repository
指定仓库/服务器配置文件目录。一般使用的fedora就是使用的后者。
一、先来看main的一些属性
 cachedir     是一个存放cache和db文件的目录。默认为/var/cache/yum.
 persistdir     information that should persist over multiple  runs.
 keepcache     0或者1的选项配置。决定在成功安装软件包之后是否保持headers和packages的缓存。默认为1,即缓存。
 reposdir      列出yum寻找.repo文件的目录,默认是/etc/yum/repos.d
 debuglevel    调试信息的输出级别,范围是0-10,默认级别为2
 errorlevel       错误信息的输出级别,范围是0-10,默认级别为2
 logfile       绝对路径以及要写入的日志文件名称。
 gpgcheck     0或者1的选项配置。这个选项告诉yum是否对软件包进行GPG认证检查,
 assumeyes     0或者1的选项配置。决定yum在最后的动作的是否确认。
                   Commmand-line option: -y
alwaysprompt      0或者1的选项配置。(不会翻译)
              Either ‘1’ or ‘0’. Without this option, yum will not prompt for confirmation when the
              list  of  packages  to  be installed exactly matches those given on the command line.
              Unless assumeyes is enabled, it will still prompt for package removal, or when  addi-
              tional packages need to be installed to fulfill dependencies. Default is ‘1’.
tolerant     宽容的,容忍的。
              0或者1的选项配置。一旦激活,yum将忽略所有来自包的错误。
              Commmand-line option: -t
exclude        列出除去升级和本地的。支持shell的匹配符。。这必须是用空格隔开的。
exactarch     0或者1的选项配置。设置为1时yum的升级仅升级系统当前的架构。例如:一旦你设置了,yum将
               不会升级你的i386包到i686包。默认为1
installonlypkgs   列出仅系统安装过的包,永远也不会升级的那种。内核就属于此类型。默认的有
                 kernel, kernel-smp, kernel-bigmem,  nel-enterprise, kernel-debug, kernel-unsupported.
 installonly_limit   可以同时在已经安装好的installonlypkgs中列出包的数量,0是禁掉此特性,默认为3
kernelpkgnames    列出内核的包的名称。
showdupesfromrepos   0或者1的选项配置。设置为1时, if you wish to show any duplicate packages from any
              repository, from package listings like the info or list commands.设置为0,从任何的仓库去看新的包。
obsoletes      此属性仅作用于升级。它激活yum的旧式的进程逻辑。用于发行版级别的升级。
overwrite_groups   0或者1的选项配置.用于决定yum对于两或更多的仓库所提供的包的组使用相同的名字时的行为。
                     如果设置为1,则这组包仅使用最后匹配的。若设置为0,同名的将会全部放到一个大的组里。
enable_group_conditionals   0或者1的选项配置.决定yum是否允许用于有条件的包,默认为1
group_package_types    列出如下类型:属性、默认值、命令。告诉YUM当"groupinstall"被调用时哪一类型的在组里包
                          将被安装。
installroot   
              Specifies an  alternative  installroot,  relative  to  which  all  packages  will  be
              installed.
              Commmand-line option: --installroot
distroverpkg
              The  package  used by yum to determine the "version" of the distribution. This can be
              any installed package. Default is ‘redhat-release’. You can see  what  provides  this
              manually by using: "yum whatprovides redhat-release".
 diskspacecheck
              Either  ‘0’  or ‘1’. Set this to ‘0’ to disable the checking for sufficient diskspace
              before a RPM transaction is run. Default is ‘1’ (perform the check).
tsflags
              Comma or space separated list of transaction flags to pass  to  the  rpm  transaction
              set. These include ’noscripts’, ’notriggers’, ’nodocs’, ’test’, and ’repackage’.  You
             recent Number of days back to look for ‘recent’ packages added to a repository.  Used by the
              list recent command. Default is ‘7’.
 retries
              Set the number of times any attempt to retrieve a file should retry before  returning
              an error. Setting this to ‘0’ makes yum try forever. Default is ‘10’.
 keepalive
              Either  ‘0’  or  ‘1’.  Set whether HTTP keepalive should be used for HTTP/1.1 servers
              that support it. This can improve transfer speeds by using one connection when  down-
              loading multiple files from a repository. Default is ‘1’.
 timeout
              Number of seconds to wait for a connection before timing out. Defaults to 30 seconds.
              This may be too short of a time for extremely overloaded sites.

 http_caching
throttle
              Enable bandwidth throttling for downloads. This option can be expressed as a absolute
              data rate in bytes/sec. An SI prefix (k, M or G) may be  appended  to  the  bandwidth
              value (eg. ‘5.5k’ is 5.5 kilobytes/sec, ‘2M’ is 2 Megabytes/sec).

              Alternatively,  this option can specify the percentage of total bandwidth to use (eg.
              ‘60%’). In this case the bandwidth option should  be  used  to  specify  the  maximum
              available bandwidth.

              Set to ‘0’ to disable bandwidth throttling. This is the default.
 bandwidth
              Use  to  specify  the maximum available network bandwidth in bytes/second.  Used with
              the throttle option (above). If throttle is a percentage and bandwidth  is  ‘0’  then
              bandwidth  throttling  will  be  disabled.  If  throttle  is expressed as a data rate
              (bytes/sec) then this option is ignored. Default is ‘0’ (no bandwidth throttling).
commands
              List of functional commands to run if no functional commands  are  specified  on  the
              command line (eg. "update foo bar baz quux").  None of the short options (eg. -y, -e,
              -d) are accepted for this option.

proxy  url to the proxy server that yum should use.
 proxy_username
              username to use for proxy
  proxy_password
  plugins
              Either ‘0’ or ‘1’. Global switch to enable or disable yum  plugins.  Default  is  ‘0’
              (plugins disabled). See the PLUGINS section of the yum(8) man for more information on
              installing yum plugins.

  pluginpath
              A list  of  directories  where  yum  should  look  for  plugin  modules.  Default  is
              ‘/usr/share/yum-plugins’ and ‘/usr/lib/yum-plugins’.

  pluginconfpath
              A  list of directories where yum should look for plugin configuration files.  Default
              is ‘/etc/yum/pluginconf.d’.
metadata_expire
              Time (in seconds) after which the metadata will expire. So that if the current  meta-
              data downloaded is less than this many seconds old then yum will not update the meta-
              data against the repository.  If you find that yum is not downloading information  on
              updates  as  often  as  you  would  like lower the value of this option. You can also
              change from the default of using seconds to using days, hours or minutes by appending
              a  d, h or m respectivley.  The default is 1.5 hours, to compliment yum-updatesd run-
              ning once an hour.  It’s also possible to use the  word  "never",  meaning  that  the
              metadata will never expire.
mirrorlist_expire
              Time (in seconds) after which the mirro  
  mdpolicy
  multilib_policy

再来看些仓库的配置属性,在fedora的发行版中,这些文件的位置在/etc/yum.repo.d/下:
   name  给仓库启用一个优雅的名称。

       baseurl    一定是指向目录的URL,而且这个目录是yum仓库的'repodata',可以是
                  可以指定多个 URL在baseurl这个元素中:最好的方法类似如下所示:
              [repositoryid]
              name=Some name for this repository
              baseurl=url://server1/path/to/repository/
                      url://server2/path/to/repository/
                      url://server3/path/to/repository/

       mirrorlist 指向一个含有baseurls的列表的文件的URL.

       enabled      指定0或1.此属性决定所在仓库是否可用。
       gpgcheck
              Either  ‘1’  or  ‘0’. This tells yum whether or not it should perform a GPG signature
              check on the packages gotten from this repository.
    gpgkey A URL pointing to the ASCII-armoured GPG key file for the repository. This option  is
              used  if  yum needs a public key to verify a package and the required key hasn’t been
              imported into the RPM database. If this option is set, yum will automatically  import
              the  key  from  the  specified  URL. You will be prompted before the key is installed
              unless the assumeyes option is set.

              Multiple URLs may be specified here in the same manner as the baseurl option (above).
              If  a  GPG key is required to install a package from a repository, all keys specified
              for that repository will be installed.

       exclude
              Same as the [main] exclude option but only for this repository.   Substitution  vari-
              ables, described below, are honored here.

       includepkgs
              Inverse  of exclude. This is a list of packages you want to use from a repository. If
              this option lists only one package then that is all yum will ever see from the repos-
              itory.  Defaults to an empty list.  Substitution variables, described below, are hon-
              ored here.

       enablegroups
              Either ‘0’ or ‘1’. Determines whether yum will allow the use of  package  groups  for
              this repository. Default is ‘1’ (package groups are allowed).

       failovermethod
              Either ‘roundrobin’ or ‘priority’.

              ‘roundrobin’  randomly  selects  a URL out of the list of URLs to start with and pro-
              ceeds through each of them as it encounters a failure contacting the host.

              ‘priority’ starts from the first baseurl listed and reads through them  sequentially.
    failovermethod defaults to ‘priority’ if not specified.

       keepalive
              Either  ‘1’  or  ‘0’. This tells yum whether or not HTTP/1.1 keepalive should be used
              with this repository. See the global option in the  [main]  section  above  for  more
              information.

       timeout
              Overrides the timeout option from the [main] section for this repository.

       http_caching
              Overrides the http_caching option from the [main] section for this repository.

       retries
              Overrides the retries option from the [main] section for this repository.

       throttle
              Overrides the throttle option from the [main] section for this repository.

       bandwidth
              Overrides the bandwidth option from the [main] section for this repository.

       metadata_expire
              Overrides the metadata_expire option from the [main] section for this repository.

       mirrorlist_expire
              Overrides the mirrorlist_expire option from the [main] section for this repository.

       proxy  url  to  the  proxy server for this repository. Set to ’_none_’ to disable the global
              proxy setting for this repository. If this is unset it inherits it  from  the  global
              setting
       proxy_username
              username to use for proxy.  If this is unset it inherits it from the global setting

       proxy_password
              password for this proxy.  If this is unset it inherits it from the global setting

       cost   relative  cost  of accessing this repository. Useful for weighing one repo’s packages
              as greater/less than any other. defaults to 1000




阅读(6311) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

asianux2008-07-22 19:31:55

好文必顶!!!赞!