程序包管理yum

YUM: YellowdogUpdate Modifier,rpm的前端程序,用来解决软件包相关依赖性,可以在多个库之间定位软件包

存储了众多rpm包,以及包的相关的元数据文件(放置于特定目录下:repodata)

文件服务器:

    ftp://

    http://

    file:///

yum客户端配置文件:

    /etc/yum.conf:为所有仓库提供公共配置

    /etc/yum.repo.d/*.repo:为仓库的指向提供配置

    仓库的指向定义:

        [repositoryID]

        name=Some name for this repository

        baseurl=url://path/to/repository/

        gpgcheck={1|0}

         gpgkey=url://path/to/key

        enabled={1|0}

        enablegroups={1|0}

        failovermethod={roundrobin|prioriy}

            默认为:roundrobin,随意挑选

        cost=

            默认为1000

yum-config-manager:管理仓库

    yum-config-manager –add-repo= http://172.16.0.1/cobbler/ks_mirror/CentOS-X-x86_64/

        yum-config-manager –disable “仓库名" 禁用仓库

        yum-config-manager –enable “仓库名” 启用仓库

yum命令的用法:

    yum [options] [command] [package …]

显示仓库列表:

    yum repolist [all|enabled|disabled]

显示程序包:

     yum list

     yum list [all | glob_exp1] [glob_exp2] […]

     yum list {available|installed|updates} [glob_exp1] […]

安装程序包:

     yum install

     install package1 [package2] […]

     reinstall package1 [package2] […]

升级程序包:

    yum update

    update [package1] [package2] […]

    downgrade package1 [package2] […]

检查可用升级:

    yum check-update

卸载程序包:

    yum remove

    remove | erase package1 [package2] […]

查看程序包information:

    yum info PACKAGE

查看指定的特性是由哪个程序包所提供:

    yum provides 

    provides | whatprovides feature1 [feature2] […]

清理本地缓存:

    yum clean

    clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]

构建缓存:

    makecache

搜索:

    yum search

    search string1 [string2] […]

查看指定包所依赖的capabilities:

    yum deplist

    deplist package1 [package2] […]

查看yum事物历史:

    yum history

    history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]

安装及升级本地程序包:

     localinstall rpmfile1 [rpmfile2] […]

     (maintained for legacy reasons only – use install)

     localupdate rpmfile1 [rpmfile2] […]

     (maintained for legacy reasons only – use update)

包组管理的相关命令:

     groupinstall group1 [group2] […]

     groupupdate group1 [group2] […]

     grouplist [hidden] [groupwildcard] […]

     groupremove group1 [group2] […]

     groupinfo group1 […]

yum的命令行选项:

     –nogpgcheck:进制进程gpg check

     -y:自动回答为yes

     -q:启用静默模式

     –disablerepo=repoidglob:临时禁用此处指定的repo

     –enablerepo=repoidglob:临时启动repo

     –noplugins:禁用所有插件

        

yum的repo配置文件中可用的变量:

     $releasever:当前OS的发行版的主版本号

     $arch:平台

     $basearch:基础平台

     $YUM0-$YUM9:自定义变量

示例:

     http://server/centos/$releasever/$basearch/

     http://server/centos/7/x86_64

     http://server/centos/6/i384

    

原创文章,作者:zhai796898,如若转载,请注明出处:http://www.178linux.com/38981