1.挂载安装光盘到系统
mount /dev/cdrom /media/
 2.复制文件到web服务器rhel5目录下
cp -fr /media/* /var/www/htm/rhel5
 3.重建记录分组文件
首先,确认系统已经安装createrepo包
cd /var/www/htm/rhel5/Server
rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm
然后重建rpm记录分组文件
createrepo -g /var/www/html/rhel5/VT/repodata/comps-rhel5-vt.xml  /var/www/html/rhel5/VT 

createrepo -g /var/www/html/rhel5/Cluster/repodata/comps-rhel5-cluster.xml  /var/www/html/rhel5/Cluster /var/www/html/rhel5/ClusterStorage

createrepo -g /var/www/html/rhel5/Server/repodata/comps-rhel5-server-core.xml 
/var/www/html/rhel5/Server 

4.在/etc/yum.repos.d目录下建立repo库文件 rhel5-http.repo 
cd /etc/yum.repos.d
vi rhel5-http.repo 
#我的机器IP是为192.168.171.3
[Cluster]
name=Red Hat Enterprise Linux $releasever - $basearch - Cluster
baseurl=http://192.168.171.3/rhel5/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ClusterStorage]
name=Red Hat Enterprise Linux $releasever - $basearch - ClusterStorage
baseurl=http://192.168.171.3/rhel5/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Server]
name=Red Hat Enterprise Linux $releasever - $basearch - Server
baseurl=http://192.168.171.3/rhel5/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]
name=Red Hat Enterprise Linux $releasever - $basearch - VT
baseurl=http://192.168.171.3/rhel5/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
   5.清除本机yum缓存
yum clean all 

测试
YUM list