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:
② 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:
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