Centos yum configuration iso automatic mounting upon startup

Source: Internet
Author: User

These two days work is to use several PCs to build a local test environment for the development team: CentOS-6.4-x86_64 + ant + svn.

To simplify the operation and ensure system stability, all systems adopt the minimal installation method. In addition, for the sake of expansion, we decided to create a local yum warehouse for each test machine to facilitate the installation of missing components without being subject to dependency.

The following describes how to use an iso image to build a local yum repository:

I. Preparations

Download or copy an iso image from CentOS or RedHat to a local device, such as/usr/local/src/CentOS-6.4-x86_64-bin-DVD1.iso

II. Mounting an iso image

① Create a Mount Directory:

 
1 Mkdir-p/mnt/cdrom1

② Directly edit the/etc/fstab File (back up the file for editing) and add the following:

 
12 # Mount iso/usr/local/src/CentOS-6.4-x86_64-bin-DVD1.iso/mnt/cdrom1 iso9660 loop, defaults 0 0

② Run mount-a to automatically detect and activate mounting. If no error is reported, run df-h to view the result.

3. Configure and refresh the yum repository

① Add the yum configuration file:

Ps: used completely offline. We recommend that you delete (remove) all online yum sources: mv-f/etc/yum. repos. d/*/home/

Vim/etc/yum. repos. d/local. repo

Paste the following content. Line 1 indicates the iso Mount Directory:

 
12345 [Local-yum] name = Local Repositorybaseurl = file: // mnt/cdrom1enabled = 1 gpgcheck = 0

② Refresh to check whether yum is effective:

 
1 Yum clean all & yum list

If no error is reported, the local yum repository is set up and you can use the [yum install software name] to install the required software without the need to connect to the Internet.

IV. Multiple iso images:

Ps: The difference is described below.

① When mounting, several iso files are mounted. For example, CentOS 6.4 has two iso files:

 
1234567 # Create two Mount directories mkdir-p/mnt/cdrom {} # Mount iso/usr/local/src/CentOS-6.4-x86_64-bin-DVD1.iso/mnt/cdrom1 iso9660 loop, defaults 0 0/usr/local/src/CentOS-6.4-x86_64-bin-DVD2.iso/mnt/cdrom2 iso9660 loop, defaults 0 0 # activate mount-

② When editing the yum configuration file, the path must be changed to the upper-level path, for example:

 
12345 [Local-yum] name = Local Repositorybaseurl = file: // mnt/enabled = 1 gpgcheck = 0

③ Use the createrepo command to create a yum repository:

 
12 Cd/mnt/createrepo.

I am very busy. I have not had time to make it available for release. I will try again when I have time.

Centos yum configuration iso automatic mounting upon startup

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.