好处:少占用3G左右空间

坏处:umount了 要重新mount iso到mnt目录

当然你也可以把iso里面的东西拷到系统目录下面,再创建repo,再删除iso文件,我就是比较懒

 

1.把安装盘iso 挂载到mnt目录

mount -t loop /root/rhel-server-5.8-x86_64-dvd.iso /mnt

2.创建存储repoxml的目录

mkdir /yum

3.安装createrepo rpm包

rpm -ivh /mnt/Server/createrepo-0.4.11-3.el5.noarch.rpm

4.生成repo 相应文件

createrepo -o /yum/ -u /mnt/ /mnt/

3414/3414 - VT/xen-devel-3.0.3-135.el5.x86_64.rpm                               pm6_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata

 

5.修改yum repo配置文件,添加

[rhel]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///yum
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

6.yum clean all    后yum list  

[root@node1 yum.repos.d]# yum list|more
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Installed Packages
Deployment_Guide-en-US.noarch               5.8-1.el5                  installed
Deployment_Guide-zh-CN.noarch               5.8-1.el5                  installed
Deployment_Guide-zh-TW.noarch               5.8-1.el5                  installed
GConf2.i386                                 2.14.0-9.el5               installed
GConf2.x86_64                               2.14.0-9.el5               installed
GConf2-devel.x86_64                         2.14.0-9.el5               installed
ImageMagick.i386                            6.2.8.0-12.el5             installed
ImageMagick.x86_64                          6.2.8.0-12.el5             installed
MAKEDEV.x86_64                              3.23-1.2                   installed
NetworkManager.i386                         1:0.7.0-13.el5             installed
NetworkManager.x86_64                       1:0.7.0-13.el5             installed
NetworkManager-glib.i386                    1:0.7.0-13.el5             installed
NetworkManager-glib.x86_64                  1:0.7.0-13.el5             installed
NetworkManager-gnome.x86_64                 1:0.7.0-13.el5             installed
ORBit2.i386                                 2.14.3-5.el5               installed
ORBit2.x86_64                               2.14.3-5.el5               installed
ORBit2-devel.x86_64                         2.14.3-5.el5               installed
OpenIPMI.x86_64                             2.0.16-12.el5              installed
OpenIPMI-libs.x86_64                        2.0.16-12.el5              installed
OpenIPMI-tools.x86_64                       2.0.16-12.el5              installed
PyQt.x86_64                                 3.16-4                     installed
PyXML.x86_64                                0.8.4-6.el5                installed
SysVinit.x86_64                             2.86-17.el5                installed