制作本地yum源



1.将光盘插入
2.挂载光盘

[root@wangl ~]# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only

3.备份原有的CentOS-Base.repo

[root@wangl ~]# cd /etc/yum.repos.d/
[root@wangl yum.repos.d]# mv  CentOS-Base.repo CentOS-Base.repo-bak

4.修改CentOS-Media.repo

[root@wangl yum.repos.d]# vi  CentOS-Media.repo

内容如下

# CentOS-Media.repo
#
#  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]

[local_cdrom]
name=local_cdrom              #源名字标识                      
baseurl=file:///mnt/          #指定路径,可以用file,ftp,http 用后面两个必须开启相应的服务。File可以用来做本地仓库
gpgcheck=0                    #是否进行gpg验证,可以关闭
enabled=1                     #是否启用源
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6   #数字签名,可注释掉

保存后即可用yum list查看

[root@wangl yum.repos.d]# yum list
可安装的软件包
389-ds-base.x86_64                       1.2.11.15-46.el6            local_cdrom
389-ds-base-devel.i686                   1.2.11.15-46.el6            local_cdrom
389-ds-base-devel.x86_64                 1.2.11.15-46.el6            local_cdrom
389-ds-base-libs.i686                    1.2.11.15-46.el6            local_cdrom
389-ds-base-libs.x86_64                  1.2.11.15-46.el6            local_cdrom
ConsoleKit-devel.i686                    0.4.1-3.el6                 local_cdrom
ConsoleKit-devel.x86_64                  0.4.1-3.el6                 local_cdrom
ConsoleKit-docs.x86_64                   0.4.1-3.el6                 local_cdrom

标签: linux, yum

相关文章

评论已关闭