不同的环境,需要不同的配置。
联网配置yum
01:打开yum配置文件
[root@desktop20 ~]# cd /etc/yum.repos.d/
[root@desktop20 yum.repos.d]# ll
total 4
-rw-r--r--. 1 root root 169 Dec 12 2014 rhel_dvd.repo
[root@desktop20 yum.repos.d]# vim rhel_dvd.repo
[rhel_dvd] #repo ID
gpgcheck = 0 /#gpg是否验证
enabled = 1 #默认yum库
baseurl = http://content.example.com/ #ftp:// file:///
name = Remote classroom copy of dvd #描述
02:国内开源镜像
http://mirrors.aliyun.com/
http://mirrors.163.com/
本地配置yum
01:hfs搭建http服务器,在redhat中wget下载
02:编辑本地yum.repo
vim /etc/yum.repos.d/rhel-source.repo
name:(可以随便写)
baseurl=file:///yum(这个就是你要挂在的本地目录)
enabled=1
gpgcheck=0
03:开机自动挂载iso影像
vim /etc/fstab
/rhel7.iso /yum iso9660 defaults,loop 0 0
04:测试yum
yum repolist
yum clean all 清楚本地缓存yum源
[root@desktop20 yum.repos.d]# yum repolist
Loaded plugins: langpacks
repo id repo name status
rhel_dvd Remote classroom copy of dvd 4,305
repolist: 4,305
参考:http://www.linuxidc.com/Linux/2013-08/88217.htm