感谢支持
我们一直在努力

Linux认证辅导:RHEL 5.4 配置 yum为本地源

首先将光盘放进光驱里。

第一步:#mount


查看光盘挂载在哪个地方。例如 我的是/dev/hdc。


#mount -t /dev/hdc  /mnt/rhel


 第二步:创建repo文件


#vim /etc/yum.repos.d/rhel-local.repo


[Cluster]
name=Red Hat Enterprise Linux $releasever – $basearch – Cluster
baseurl=file:///media/rhel/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=file:///media/rhel/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=file:///media/rhel/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=file:///media/rhel/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


第三步:


#mkdir -p /var/rhel/{Cluster,ClusterStorage,Server,VT}


第四步:安装createrepo命令。


#cd /mnt/rhel/Server/


# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm


第五步:重建comps-rhel5-*.xml文件


#createrepo -o /var/rhel/Cluster -g /media/rhel/Cluster/repodata/comps-rhel5-cluster.xml /media/rhel/Cluster
#createrepo -o /var/rhel/ClusterStorage -g /media/rhel/ClusterStorage/repodata/comps-rhel5-cluster-st.xml /media/rhel/ClusterStorage
#createrepo -o /var/rhel/Server -g /media/rhel/Server/repodata/comps-rhel5-server-core.xml /media/rhel/Server
#createrepo -o /var/rhel/VT -g /media/rhel/VT/repodata/comps-rhel5-vt.xml /media/rhel/VT


#mount –bind /var/rhel/Cluster/repodata /media/rhel/Cluster/repodata
#mount –bind /var/rhel/ClusterStorage/repodata /media/rhel/ClusterStorage/repodata
#mount –bind /var/rhel/Server/repodata /media/rhel/Server/repodata
#mount –bind /var/rhel/VT/repodata /media/rhel/VT/repodata


第六步:


#yum clean all


第七步:


#yum install package


其实只做红色部分的就可以了。其它是虚拟化和集群用的。可以不用加入。

赞(0) 打赏
转载请注明出处:服务器评测 » Linux认证辅导:RHEL 5.4 配置 yum为本地源
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏