本地yum源搭建
环境介绍:
1、虚拟机版本:VMwareWorkstation 12 Pro
2、安装系统:CentOS7.2
3、光盘或镜像文件:CentOS7.2镜像文件
(1)挂载CentOS7.2镜像文件到/mnt目录
[[email protected] ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected, mounting read-only
(2)切换到/etc/yum.repos.d/目录
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
(3)备份CentOS-Base.repo
[[email protected] yum.repos.d]# cp CentOS-Base.repo CentOS-Base.repo.BAK
(4)清空及编辑CentOS-Base.repo文件
[[email protected] yum.repos.d]# > CentOS-Base.repo
[[email protected] yum.repos.d]# vi CentOS-Base.repo
[local_server]
name=This is a local repo
baseurl=file:///mnt
enabled=1
gpgcheck=0
保存退出后,本地yum源搭建已完成,以下我们进行测试:
(5)测试
清除缓存:[[email protected] ~]# yum clean all
建立新缓存:[[email protected] ~]# yum makecache
安装vim: [[email protected] ~]# yum install vim -y
安装成功,说明我们的本地yum源搭建也就成功了。