Here we will use a virtual machine demonstration and record it for future reference.
I. Attach a CD image
Load localBin-DVDMirror file to virtual machine system ,:
Ii. Change Yum Source
1Attach a CD image
For example, run the following command:
Mkdir test1
Mount/dev/CDROM test1
We can see that/Dev/CDROMMountedTest1Directory.
2, ModifyYumConfiguration File
YumThe configuration file directory of is:/Etc/yum. Repos. d/
The file to be modified here is:CentOS-Media.repo
The original file is as follows:
C6-media
Name = centos-$ releasever-Media
Baseurl = file: // media/centos/
File: // media/CDROM/
File: // media/cdrecorder/
Gpgcheck = 1
Enabled = 0
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
The field description is as follows:
Name: (Custom) Name
Baseurl: Search Path
Gpgcheck: Check?GPG-KEY,0Do not check,1For check
Enabled: Enabled or notYumSource,0Is not enabled,1To enable
We only needBaseurlAdd the directory where the CD is attached, that is:
3. Install software ( Gcc )
SearchGCC:
Yum-disablerepo = * enablerepo = c6-media search gcc
InstallGCC:
Yum-disablerepo = * enablerepo = c6-media install GCC *
There are many methods. Here I just record one of them.