# cat localhost_yum.sh
#!/bin/bash
#Author:Nortorm
#Filename:localhost_yum.sh
cd /etc/yum.repos.d/
/usr/bin/rename repo repo.bak *.repo
echo "mount -t iso9660 /dev/cdrw1 /mnt/" >>/etc/rc.local
mount -t iso9660 /dev/cdrw1 /mnt/
sleep 1
cat << EOF >local.repo
[RHEL-BASE]
name=base
baseurl=file:///mnt/
enabled=1
gpgcheck=0
EOF
yum repolist
exit $?
转载于:https://my.oschina.net/nortorm/blog/424019