rhel5 的yum默认无法从光盘安装软件,网络上教程一堆,但是没有一个完整可用的。经过试验总结如下
1.挂载光盘或镜像
#mount -o loop rhel5.iso /mnt/cdrom
#mount /dev/cdrom /mnt/cdrom
2. vi /etc/yum.repos.d/rhel-local.repo
[Cluster]
name=Red Hat Enterprise Linux $releasever - $basearch - Cluster
baseurl=file:///mnt/cdrom/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:///mnt/cdrom/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:///mnt/cdrom/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:///mnt/cdrom/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
3. mkdir -p /var/rhel/{Cluster,ClusterStorage,Server,VT}
4.
createrepo -o /var/rhel/Cluster -g /mnt/cdrom/Cluster/repodata/comps-rhel5-cluster.xml /mnt/cdrom/Cluster
createrepo
-o /var/rhel/ClusterStorage -g
/mnt/cdrom/ClusterStorage/repodata/comps-rhel5-cluster-st.xml
/mnt/cdrom/ClusterStorage
createrepo -o /var/rhel/Server -g /mnt/cdrom/Server/repodata/comps-rhel5-server-core.xml /mnt/cdrom/Server
createrepo -o /var/rhel/VT -g /mnt/cdrom/VT/repodata/comps-rhel5-vt.xml /mnt/cdrom/VT
5.
mount --bind /var/rhel/Cluster/repodata /mnt/cdrom/Cluster/repodata
mount --bind /var/rhel/ClusterStorage/repodata /mnt/cdrom/ClusterStorage/repodata
mount --bind /var/rhel/Server/repodata /mnt/cdrom/Server/repodata
mount --bind /var/rhel/VT/repodata /mnt/cdrom/VT/repodata
6. yum clean all
7. vi /etc/yum.conf
[iso]
name=iso
baseurl=file:///mnt/cdrom/Server
gpgcheck=0
8. yum update
9. 现在可以任意安装了(装个apache试试)
#yum install httpd
阅读(767) | 评论(0) | 转发(0) |