centos用ISO光盘镜像搭建本地yum源

作者: halazi100 2014-11-04 13:33:27
[i=s] 本帖最后由 halazi100 于 2014-11-13 17:10 编辑 [/i]

setup local repo for yum with DVD.iso file in CentOS system


+---------------------------------+
| for centos 6.6 |
+---------------------------------+

1. mount the DVD iso file
# mkdir /media/_local_repo_DVD1
# mount -o loop -t iso9660 CentOS-6.6-i386-bin-DVD1.iso /media/_local_repo_DVD1

2. backup the original repo files in /etc/yum.repos.d/
# mv CentOS-Base.repo CentOS-Base.repo.backup
use this method to backup all other repo files;

3. edit the empty file /etc/yum.repos.d/_local_DVD.repo
# vim /etc/yum.repos.d/_local_DVD.repo
-------------------------------------------------------
[_local_DVD_repo]
name=This is a local repo.
baseurl=file:///media/_local_repo_DVD1
# file:///media/_local_repo_DVD2
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=30
-------------------------------------------------------

4. refresh the cache for yum
# yum clean all
# yum makecache




+---------------------------------+
| for centos 7.0-1406 |
+---------------------------------+


1. mount the DVD iso file
# mkdir /media/_local_repo_DVD1
# mount -o loop -t iso9660 CentOS-7.0-1406-x86_64-bin-DVD.iso /media/_local_repo_DVD

2. backup the original repo files in /etc/yum.repos.d/
# mv CentOS-Base.repo CentOS-Base.repo.backup
use this method to backup all other repo files;

3. edit the empty file /etc/yum.repos.d/_local_DVD.repo
# vim /etc/yum.repos.d/_local_DVD.repo
-------------------------------------------------------
[_local_DVD_repo]
name=This is a local repo.
baseurl=file:///media/_local_repo_DVD
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
priority=30

-------------------------------------------------------

4. refresh the cache for yum
# yum clean all
# yum makecache

相关资讯