基于虚拟机的centos6.5 搭建本地光盘yum源

在线yum安装必需要保持服务器可以连入网络而且他下载的还会比较慢由于地址大部分可能是国外的下载站。另外yum在线下载的都是比较新的软件包,可能不是很稳定,那么使用yum的本地资源就是光盘里的RPM包,让本地光盘做为yum源,这种源的版本可能不是最新的可是相对比较稳定,这种方式通常在工做中比经常使用。下面就来介绍下光盘yum源安装。centos

第一步:
虚拟机以vmwareworkstations 为例安装centos6.5虚拟机 并设置链接镜像1

 

 第二步:挂载光盘
[root@server ~]#mkdir cdrom //建立挂载点。

[root@server ~]# mount /dev/sr0 /mnt/cdrom  //手动挂载。 服务器

 

[root@server ~]# mount网络

 

//显示已经挂载成功this

第三步:将默认的网络yum源失效

[root@server ~]# ls /etc/yum.repos.d/url

CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo  CentOS-Vault.repo[Y1] spa

 

 [Y1]默认状况下使用的是第一个也就是网络yum源文件生效,若是使他生效只须要将enable=1便可。若是让全部的yum源不生效那么把enable=0就能够。server

第三步:修改yum源  配置文件  生效

[root@server ~]# vi /etc/yum.repos.d/CentOS-Media.repoblog

# CentOS-Media.repo资源

#get

#  This repo can be used with mounted DVD media, verify the mount point for

#  CentOS-6.  You can use this repo and yum to install items directly off the

#  DVD ISO that we release.

#

# To use this repo, put in your DVD and use it with the other repos too:

#  yum --enablerepo=c6-media [command]

#

# or for ONLY the media repo, do this:

#

#  yum --disablerepo=\* --enablerepo=c6-media [command]

 

[c6-media]

name=CentOS-$releasever - Media

baseurl=file:///mnt/cdrom/        //将这里修改成光盘挂载的地址

#        file:///media/cdrom/   

#        file:///media/cdrecorder/    //将这两个没用的地址给注释掉就是#

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

"/etc/yum.repos.d/CentOS-Media.repo" 21L, 629C

:wq!//保存退出

第五步:查看rpm包文件  搭建成功

相关文章
相关标签/搜索