RedHat Linux 本地yum源的配置
1、虚拟机下配置yun源[root@localhost ~]# mkdir /isomount /dev/cdrom /isocd /isoll[root@localhost iso]# cd /etc/yum.repos.d/[root@localhost yum.repos.d]# lsrhel-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 HatEnterprise 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-G PG-KEY-RedHat-release
2、[root@localhost yum.repos.d]# pwd/etc/yum.repos.d[root@localhost yum.repos.d]# lltotal 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
3、真实机配置本地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/localmount /dev/cdrom /iso更多详细操作可以参考《linux就该这么学》