ArticleDirectory
- Install the createrepo package
- Create and install a DVD Image
- Create a local software source
The purpose of this experiment is to use two centos DVD installation discs as the local software source to avoid re-downloading from the network every time you execute the yum installation command.
Install the createrepo package
Createrepo is a tool required to create a software source. By default, the software package is not installed for the minimum centos installation. This software package is in the first installation DVD of centos and needs to be installed manually.
1. Start centos server. Place the first installation DVD of centos into the optical drive and mount it to the/Media/CDROM directory.
[Root @ localhost ~] #Mkdir-P/Media/CDROM [root @ localhost~] #Mount-T iso9660/dev/CDROM/Media/CDROM
2. All software sources of centos are defined in the/etc/yum. Repos. d directory. By default, a software source that has a c6-media defined is disabled.
Open the/etc/yum. Repos. d/CentOS-Media.repo file and we can find that one of the locations in the software source's location list just points to the/Media/CDROM directory:
3. Install the createrepo package using the c6-media software source.
[Root @ localhost ~] # Yum -- disablerepo = * -- enablerepo = c6-mediaInstallCreaterepo
Create and install a DVD Image
In this process, make the two centos installation DVDs into an ISO image file and put them in the/media directory.
1. Put the first DVD into the optical drive and execute the following command:
[Root @ localhost ~] #Dd If=/Dev/CDROM of =/Media/centos-6.2X86_64-bin-DVD1.iso
2. Put the second DVD into the optical drive and execute the following command:
[Root @ localhost ~] #Dd If=/Dev/CDROM of =/Media/centos-6.2X86_64-bin-DVD2.iso
OK. Now there should be two more ISO files in the/media directory.
Create a local software source
The local software source program created in this experiment is stored in the/usr/local/Yum directory. The first ISO file is mounted to the subdirectory dvd1 and the second ISO file is mounted to the subdirectory dvd2.
1. Create the/usr/local/Yum directory and mount the dvd iso file.
[Root @ localhost ~] #Mkdir-P/usr/local/Yum/DVD {1,2} [Root @ localhost~] #Mount-O loop/Media/centos-6.2-X86_64-bin-DVD1.iso/usr/local/Yum/Dvd1 [root @ localhost~] #Mount-O loop/Media/centos-6.2-X86_64-bin-DVD2.iso/usr/local/Yum/dvd2
2. Run the createrepo command to create the software source directory.
[Root @ localhost ~] # Createrepo/usr/local/yum
After the execution is completed, a subdirectory named repodata is added to the/usr/local/Yum directory.
3. Create the software source definition file/etc/yum. Repos. d/CentOS-ISO.repo. The file content is as follows:
[C6-iso]Name=Centos-$ releasever-isobaseurl=File: // usr/local/Yum/gpgcheck= 0Enabled= 1
4. Open the/ECT/yum. Repos. d/CentOS-Base.repo file and disable the software source defined in it (plus enabled = 0 ):
If there are other software sources enabled, disable them as needed. Finally, the status of all software sources should be similar:
OK, so far, the local software source c6-iso has been successfully established, use the yum command to test our results:
Reference: http://www.cnblogs.com/eastson/archive/2012/07/06/2578758.html