您的位置:首页 > 运维架构 > Linux

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

2014-11-04 11:42 239 查看
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

when you install the software and warning you

GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6"

please use

# rpmkeys --import
/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

+---------------------------------+

| 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

when you install the software and warning you

GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7"

please use

# rpmkeys --import
/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: