虚拟机下配置yun源
[root@localhost ~]# mkdir /iso
mount /dev/cdrom /iso
cd /iso
ll
[root@localhost iso]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
rhel-source.repo
[root@localhost yum.repos.d]# cp rhel-source.repo iso.repo
[root@localhost yum.repos.d]# cat iso.repo
#yun源的名字,做到全局唯一不重复
[rhel-iso]
#注释信息
name=Red Hat Enterprise Linux $releasever - $basearch - Source
#yum源的路径,支持三种协议:http、ftp、file,其中file表示本地文件,/iso才是真实路径
baseurl=file:///iso
#1表示启用,0表示禁用
enabled=1
#指纹校验,为0表示不校验
gpgcheck=0
#校验参考的文件
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release
[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]# ll
total 8
-rw-r--r--. 1 root root 173 Jul 23 19:09 iso.repo
-rw-r--r--. 1 root root 529 Apr 28 2011 rhel-source.repo
#可以测试是否配置成功,还可以进入iso查看是否有文件
[root@larrywen yum.repos.d]# yum grouplist|grep Devel
Additional Development
Desktop Platform Development
Development tools
Server Platform Development
真实机配置本地yum源
[root@larrywen yum.repos.d]#mkdir /iso
[root@larrywen yum.repos.d]# cp rhel-source.repo iso.repo
[root@larrywen yum.repos.d]# cat iso.repo
#yun源的名字,做到全局唯一不重复
[rhel-iso]
#注释信息
name=Red Hat Enterprise Linux $releasever - $basearch - Source
#yum源的路径,支持三种协议:http、ftp、file,其中file表示本地文件,/iso才是真实路径
baseurl=file:///iso
#1表示启用,0表示禁用
enabled=1
#指纹校验,为0表示不校验
gpgcheck=0
#校验参考的文件
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
#本地需要挂载,使用mount命令即可
[root@larrywen yum.repos.d]# mount
/home/Wentasy/software/rhel-server-6.1-x86_64-dvd.iso /iso -o loop
#可以测试是否配置成功,还可以进入iso查看是否有文件
[root@larrywen yum.repos.d]# yum grouplist|grep Devel
Additional Development
Desktop Platform Development
Development tools
Server Platform Development
#mount后重启失效,要想永久生效,添加此句话
[root@localhost yum.repos.d]# echo "mount /dev/cdrom /iso" >> /etc/rc.local
[root@localhost yum.repos.d]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
mount /dev/cdrom /iso