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