一.搭建本地yum
1.让镜像被系统识别 mount
[root@localhost Desktop]# mount /root/Desktop/rhel-server-7.0-x86_64-dvd.iso /mnt
#挂载iso到/mnt
mount: /dev/loop0 is write-protected, mounting read-only
[root@localhost Desktop]# df #查看挂哉信息
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 6820256 3653644 66% /
devtmpfs 469332 0 469332 0% /dev
tmpfs 484920 140 484780 1% /dev/shm
tmpfs 484920 12796 472124 3% /run
tmpfs 484920 0 484920 0% /sys/fs/cgroup
/dev/loop0 3654720 3654720 0 100% /mnt
2.卸载 umount
[root@localhost Desktop]# umount /mnt
[root@localhost Desktop]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 10473900 6820256 3653644 66% /
devtmpfs 469332 0 469332 0% /dev
tmpfs 484920 140 484780 1% /dev/shm
tmpfs 484920 12796 472124 3% /run
tmpfs 484920 0 484920 0% /sys/fs/cgroup
###当路径在/nmt目录内时,不能卸载/mnt
会提示正忙,只能切换到别的路径再卸载
3.配置本地yum源
1).获得一个与本地系统一致的镜像
2).挂载镜像(让镜像被系统识别和使用mount)
3).设定系统安装源指定(/etc/yum.repos.d/下新建一个以.repo结尾的文件,内容按格式) 要把其他的repo文件删除
4).测试
2).挂载镜像(让镜像被系统识别和使用)
[root@localhost Desktop]# mount /root/Desktop/rhel-server-7.0-x86_64-dvd.iso /mnt
3).设定系统安装源指定
[root@localhost Desktop]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# ls
rhel_dvd.repo
[root@localhost yum.repos.d]# vim test.repo #随意起名,但是必须以.repo结尾
[rhel 7.0] #仓库描述
name=rhel7.0 test #软件源描述(名字)
baseurl=file:///mnt #镜像挂载的地址
gpgcheck=0 #不检查gpgkey&