1 . 挂载rhel-server-6.4-x86_64-dvd.iso到/mnt目录

         [root@localhost yum.repos.d]# mount -o loop rhel-server-6.4-x86_64-dvd.iso /mnt/
2  yum repo文件

        cd /etc/yum.repos.d/     yum仓库repo文件的路径

        [root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]#

一. 如何为yum定义repo文件


[root@localhost yum.repos.d]# cat -b iso.repo 
     1  [rhel-debuginfo]
     2  name=Red Hat Enterprise Linux $releasever - $basearch - Debug
     3  baseurl=ftp://192.168.1.254/pub/Server/    访问主机的服务
     4  baseurl=file:///var/ftp/pub/Server/        访问本地的服务     

                                                                          rhel5必须添加/Server

                                                                          rhel6直接到目录挂载目录即可

     5  baseurl=http://     

     6  enabled=1
     7  gpgcheck=0
     8  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@localhost yum.repos.d]#

二.  yum 命令

                1. yum clean all  清除缓存          

                2. yum list 查看已经安装的软件包

                            支持glob通配符的机制

                            yum list all

                            yum list  available:可用的,yum仓库中有但尚未安装

                            yum list  installed:已经安装的

                3. repolist:显示repo列表及其简要信息

                            yum repolist  all

                            yum repolist   enabled:默认

                            yum repolist    disabled
                 4. yum grouplist  查看已安装的软件包组
                            -y 提示是否安装
                 5. yum install 软件包名   安装要安装的软件包名

                 6. yum -y install  softname  软件包名   安装要安装的软件包名               
                 7. yum  grouplist 显示软件包组名

                                yum  -y groupinstall softgropname   安装要安装的软件包组名

                                yum -y groupinfo softname  查询指定包组名的说明信息

                                yum groupremove 删除软件包组

                                yum groupupdate  升级软件包组

                 8. yum -y remove softname    要删除的软件包

                 9. yum search | grep ftp(软件包名)  查看是否有这个的软件包    搜索是否有这个软件包
                 10. update:升级

                            update_to:升级为指定版本

                11. yum info 软件包:查询指定包的说明信息

                12. provides | whatprovides:查看指定的文件或特性是由哪个包安装生成的

                          列子:以/etc/init.d为例                      

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@localhost etc] # yum provides /etc/init.d/
Loaded plugins: product- id , refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
chkconfig-1.3.49.3-2.el6.x86_64 : A system tool  for  maintaining the  /etc/rc *.d
                                 : hierarchy
Repo        : rhel- source
Matched from:
Filename    :  /etc/init .d/
 
chkconfig-1.3.49.3-2.el6.x86_64 : A system tool  for  maintaining the  /etc/rc *.d
                                 : hierarchy
Repo        : installed
Matched from:
Other       : Provides-match:  /etc/init .d/