第三章:yum命令的使用

  1 yum命令的用法:
  2     yum [options] [command] [package ...]
  3 
  4    command is one of:
  5     * install package1 [package2] [...]
  6     * update [package1] [package2] [...]
  7     * update-to [package1] [package2] [...]
  8     * check-update
  9     * upgrade [package1] [package2] [...]
 10     * upgrade-to [package1] [package2] [...]
 11     * distribution-synchronization [package1] [package2] [...]
 12     * remove | erase package1 [package2] [...]
 13     * list [...]
 14     * info [...]
 15     * provides | whatprovides feature1 [feature2] [...]
 16     * clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]
 17     * makecache
 18     * groupinstall group1 [group2] [...]
 19     * groupupdate group1 [group2] [...]
 20     * grouplist [hidden] [groupwildcard] [...]
 21     * groupremove group1 [group2] [...]
 22     * groupinfo group1 [...]
 23     * search string1 [string2] [...]
 24     * shell [filename]
 25     * resolvedep dep1 [dep2] [...]
 26     * localinstall rpmfile1 [rpmfile2] [...]
 27        (maintained for legacy reasons only - use install)
 28     * localupdate rpmfile1 [rpmfile2] [...]
 29        (maintained for legacy reasons only - use update)
 30     * reinstall package1 [package2] [...]
 31     * downgrade package1 [package2] [...]
 32     * deplist package1 [package2] [...]
 33     * repolist [all|enabled|disabled]
 34     * version [ all | installed | available | group-* | nogroups* | grouplist | groupinfo ]
 35     * history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]
 36     * check
 37     * help [command]
 38 
 39 显示仓库列表:
 40     repolist [all|enabled|disabled]
 41 
 42 显示程序包:
 43     list
 44         # yum list [all | glob_exp1] [glob_exp2] [...]
 45         # yum list {available|installed|updates} [glob_exp1] [...]
 46 
 47 安装程序包:
 48     install package1 [package2] [...]
 49 举例:[root@localhost ~]# yum -y install lrzsz
 50     reinstall package1 [package2] [...]  (重新安装)
 51 
 52 升级程序包:
 53     update [package1] [package2] [...]
 54 举例:[root@localhost ~]# yum update lzrsz
 55     downgrade package1 [package2] [...] (降级)
 56 
 57 检查可用升级:
 58     check-update
 59 
 60 卸载程序包:
 61     remove | erase package1 [package2] [...]
 62 举例:[root@localhost ~]# yum update lzrsz
 63 查看程序包information:
 64     info [...]
 65 
 66 查看指定的特性(可以是某文件)是由哪个程序包所提供:
 67     provides | whatprovides feature1 [feature2] [...]
 68 
 69 清理本地缓存:
 70 clean [headers|packages|metadata|dbcache|plugins|expire-cache|all]
 71 
 72 构建缓存:
 73     makecache
 74 
 75 搜索:
 76     search string1 [string2] [...]
 77 
 78     以指定的关键字搜索程序包名及summary信息;
 79 
 80 查看指定包所依赖的capabilities:
 81     deplist package1 [package2] [...]
 82 
 83 查看yum事务历史:
 84     history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]
 85 
 86 安装及升级本地程序包:
 87     * localinstall rpmfile1 [rpmfile2] [...]
 88        (maintained for legacy reasons only - use install)
 89     * localupdate rpmfile1 [rpmfile2] [...]
 90        (maintained for legacy reasons only - use update)
 91 
 92 包组管理的相关命令:
 93     * groupinstall group1 [group2] [...]
 94     * groupupdate group1 [group2] [...]
 95     * grouplist [hidden] [groupwildcard] [...]
 96     * groupremove group1 [group2] [...]
 97     * groupinfo group1 [...]
 98 
 99 如何使用光盘当作本地yum仓库:
100     (1) 挂载光盘至某目录,例如/media/cdrom
101         # mount -r -t iso9660 /dev/cdrom /media/cdrom
102     (2) 创建配置文件
103     [CentOS7]
104     name=
105     baseurl=
106     gpgcheck=
107     enabled=
108 
109 yum的命令行选项:
110     --nogpgcheck:禁止进行gpg check;
111     -y: 自动回答为“yes”;
112     -q:静默模式;
113     --disablerepo=repoidglob:临时禁用此处指定的repo;
114     --enablerepo=repoidglob:临时启用此处指定的repo;
115     --noplugins:禁用所有插件;
116 
117 yum的repo配置文件中可用的变量:
118     $releasever: 当前OS的发行版的主版本号;
119     $arch: 平台;
120     $basearch:基础平台;
121     $YUM0-$YUM9
122 
123 [base]
124 name=Chaoge repo 
125 baseurl=http://chaoge.com/centos/7/os/x86_64/  #使用变量替换,就很方便了
126 baseurl=http://chaoge.com/centos/6/os/x86_64/
127 baseurl=http://chaoge.com/centos/5/os/x86_64/
128 gpgcheck=0

 

posted @ 2020-12-09 16:02  寒江孤影(打工仔)  阅读(107)  评论(0编辑  收藏  举报