Use CentOS DVD1 and DVD2 for local yum Source

Source: Internet
Author: User

Use CentOS DVD1 and DVD2 for local yum Source

CentOS6 and later versions generally provide a DVD1 and a DVD2 image. You can use DVD1 to install and use CentOS. DVD2 stores some additional software packages. This article describes how to create and use a local yum repository.

Merge two DVD images of CentOS 6

1. Related directories:

/Mnt/dvd1 and/mnt/dvd2 are used to mount Centos images.

/Mnt/dvd3 merged image file

/Mnt/iso Storage

Mkdir-p/mnt/dvd1/mnt/dvd2/mnt/dvd3/mnt/iso

2. Upload the Centos image to the server and mount the Centos image file.

Mount-o loop/mnt/iso/CentOS-6.5-x86_64-bin-DVD1.iso/mnt/dvd1

Mount-o loop/mnt/iso/CentOS-6.5-x86_64-bin-DVD2.iso/mnt/dvd2

3. Copy an object

First, copy all the files in the first DVD to the/mnt/dvd3 directory. Then, only copy all RPM files in the Packages directory of the second DVD to the/mnt/dvd3/Packages directory.

Cp-av/mnt/dvd1/mnt/dvd3

Cp-v/mnt/dvd2/Packages/*. rpm/mnt/dvd3/Packages/

4. Merge TRANS. TBL

Append the TRANS. TBL information in DVD2 to the end of TRANS. TBL in DVD1, and sort and save the information.

Cat/mnt/dvd2/Packages/TRANS. TBL>/mnt/dvd3/Packages/TRANS. TBL

Mv/mnt/dvd3/Packages/{TRANS. TBL, TRANS. TBL. BAK}

Sort/mnt/dvd3/Packages/TRANS. TBL. BAK>/mnt/dvd3/Packages/TRANS. TBL

Rm-rf/mnt/dvd3/Packages/TRANS. TBL. BAK

Dvd3 is a merged file and can be used as a local source and ISO.

5. Back up the YUM configuration file

Cd/etc/yum. repos. d

Rename. repo. repo. bak *. repo

6. generate a new YUM configuration file

Vi/etc/yum. repos. d/CentOS-Media.repo

C6-media

Name = CentOS-\ $ releasever-Media

Baseurl = file: // mnt/dvd3

Gpgcheck = 0

Enabled = 1

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

7. Update YUM Source

Yum clean all

Yum upgrade

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.