1,进入/etc/yum.repos.d目录中,编辑rhel5-local.repo文件,这个文件名可以随便取,以个人爱好为准,加入如下内容:
[Cluster]
name=RedHatEnterpriseLinux$releasever-$basearch-Cluster
baseurl=file:///mnt/rhel5/Cluster
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[ClusterStorage]
name=RedHatEnterpriseLinux$releasever-$basearch-ClusterStorage
baseurl=file:///mnt/rhel5/ClusterStorage
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Server]
name=RedHatEnterpriseLinux$releasever-$basearch-Server
baseurl=file:///mnt/rhel5/Server
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[VT]
name=RedHatEnterpriseLinux$releasever-$basearch-VT
baseurl=file:///mnt/rhel5/VT
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
2,挂载你的rhel5.iso文件.
mount/dev/hdc/mnt/rhel5
我是在vmware里做的,它的光驱就是/dev/hdc设备。
3,创建以下几个必要的目录:
mkdir-p/var/rhel/{Cluster,ClusterStorage,Server,VT}
4,用createrepo命令创建相应文件,前提你必须安装createrepo软件包:
createrepo-o/var/rhel/Cluster-g/mnt/rhel5/Cluster/repodata/comps-rhel5-cluster.xml/mnt/rhel5/Cluster
createrepo-o/var/rhel/ClusterStorage-g/mnt/rhel5/ClusterStorage/repodata/comps-rhel5-cluster-st.xml/mnt/rhel5/ClusterStorage
createrepo-o/var/rhel/Server-g/mnt/rhel5/Server/repodata/comps-rhel5-server-core.xml/mnt/rhel5/Server
createrepo-o/var/rhel/VT-g/mnt/rhel5/VT/repodata/comps-rhel5-VT.xml/mnt/rhel5/VT
5,挂载:
mount--bind/var/rhel/Cluster/repodata/mnt/rhel5/Cluster/repodata
mount--bind/var/rhel/ClusterStorage/repodata/mnt/rhel5/ClusterStorage/repodata
mount--bind/var/rhel/Server/repodata/mnt/rhel5/Server/repodata
mount--bind/var/rhel/VT/repodata/mnt/rhel5/VT/repodata
6,yumcleanall
剩下的就是安装软件包和更新了,呵呵,自己试试吧!
下载本文示例代码