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

来源:互联网 发布:神仙吃什么知乎 编辑:程序博客网 时间:2024/04/29 00:04

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

 

0 0
原创粉丝点击