CentOS to build Yum server by means of CD-ROM mount

Source: Internet
Author: User
Tags gpg centos

Introduction of experimental environment

Create a new two virtual machine using VMware Workstation, install CentOS release 6.4 (Final) x86_64

The iptables and SELinux of both hosts have been closed.

CentOS1 plan to install Yum Data Warehouse IP as 192.168.80.3

CentOS2 plan acts as a client IP for 192.168.80.4

Build local yum server via CD-ROM

This experiment program through VSFTP to act as Yum Data Warehouse, need to pre-installed the following software:

VSFTP, FTP, Createrepo

The above software we first by mounting the CD-ROM, build the local source, to install

1. Mount CD

# mount/dev/cdrom/media/

Mount:block Device/dev/sr0 is write-protected, mounting read-only

2. Check whether the mount is successful

# df-h

FileSystem Size Used Avail use% mounted on

/dev/mapper/volgroup-lv_root

18G 2.0G 15G 13%/

Tmpfs 495M 0 495M 0%/dev/shm

/DEV/SDA1 485M 33M 427M 8%/boot

/dev/sr0 4.1G 4.1G 0 100%/media

/media's already mounted.

3. Confirm the Repomd.xml Path

# find/media/-name Repomd.xml

/media/repodata/repomd.xml

Yum need to read the software dependencies file Repomd.xml

But different discs, the location of this file may not be the same, such as my hand, another Rhel CD image

# Mount-o Loop rhel-server-5.4-i386-dvd.iso/mnt

# find/mnt/-name Repomd.xml

/mnt/cluster/repodata/repomd.xml

/mnt/clusterstorage/repodata/repomd.xml

/mnt/server/repodata/repomd.xml

/mnt/vt/repodata/repomd.xml

As you can see, there is no/repodata directory below the/mnt directory, and if we configure the Yum client below, there will be an error when specifying the path to the data warehouse directly as/MNT, in case we first confirm the location of the file.

4. Back up repo files

# cd/etc/yum.repos.d/

# ls

Centos-base.repo Centos-debuginfo.repo Centos-media.repo Centos-vault.repo

# rename Repo Repo.bak *

# ls

Centos-base.repo.bak Centos-debuginfo.repo.bak Centos-media.repo.bak Centos-vault.repo.bak

5. New Yum Client configuration file Centos-local.repo

We can use the Centos-debuginfo.repo.bak file to make a template

# cp-a Centos-debuginfo.repo.bak Centos-local.repo

# Vi/etc/yum.repos.d/centos-local.repo

[Local]

Name=centos-6-Localinfo

Baseurl=file:///media

Gpgcheck=1

Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

Enabled=1

Related Article

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.