前几天把一台服务器的OS由centos换成了rhel,同时搭建了本地yum源。

mkdir -p /mnt/cdrom
mount -t iso9660 -o loop rhel-server-5.4-x86_64-dvd.iso /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
rpm -ivh /mnt/cdrom/Server/createrepo*
rpm -ivh /mnt/cdrom/Server/yum*
mkdir /yum
mkdir /yum/rhel5

cp -rv /mnt/cdrom/Server/ /yum/rhel5/
cp -rv /mnt/cdrom/VT/ /yum/rhel5/
cp -rv /mnt/cdrom/ClusterStorage/ /yum/rhel5/
cp -rv /mnt/cdrom/Cluster/ /yum/rhel5/
createrepo -g /data/www/yum/rhel5/VT/repodata/comps-rhel5-vt.xml /data/www/yum/rhel5/VT
createrepo -g /data/www/yum/rhel5/Cluster/repodata/comps-rhel5-cluster.xml /data/www/yum/rhel5/Cluster
createrepo -g /data/www/yum/rhel5/ClusterStorage/repodata/comps-rhel5-cluster-st.xml /data/www/yum/rhel5/ClusterStorage
createrepo -g /data/www/yum/rhel5/Server/repodata/comps-rhel5-server-core.xml /data/www/yum/rhel5/Server
cat > /etc/yum.repos.d/ops.repo < [Cluster]
name=Red Hat Enterprise Linux $releasever - $basearch - Cluster
baseurl=http://192.168.0.200/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.0.200/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.0.200/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.0.200/rhel5/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
EOF
yum clean all

哟?不错哎 订阅小米的RSS Feeds 回去慢慢看^_^