Perform tests based on the network methods and organize them:
Environment: centos
1. Create a mount directory for the DVD
[Root @ localhost ~] # Mkdir/Media/centos
2. Mount centos DVD in Linux
[Root @ localhost ~] # Mount-T Auto/dev/CDROM/Media/centos
3. view the related configuration file. The directory is
[Root @ localhost ~] # Ls-L/etc/yum. Repos. d/
-RW-r --. 1 Root 1926 Jun 26 CentOS-Base.repo
-RW-r --. 1 Root 637 Jun 26 CentOS-Debuginfo.repo
-RW-r -- 1 Root 628 Nov 29 CentOS-Media.repo
-RW-r --. 1 Root 2593 Jun 26 CentOS-Vault.repo
4. Disable the network update method of yum, simply rename the default preferred CentOS-Base.repo to the CentOS-Base.repo.bak.
[Root @ localhost yum. Repos. d] # Music CentOS-Base.repo CentOS-Base.repo.bak
5. Configure the local Yum Source
[Root @ localhost ~] # Vim/etc/yum. Repos. d/CentOS-Media.repo
Set
C6-media
Name = centos-$ releasever-Media
Baseurl = file: // media/centos/
File: // media/CDROM/
File: // media/cdrecorder/
Gpgcheck = 1
Enabled = 0
Change
C6-media
Name = centos-$ releasever-Media
Baseurl = file: // media/centos/
Gpgcheck = 1
Enabled = 1
Modify the baseurl to the Mount directory of the DVD. Enabled = 1 to enable the local update mode.
: WQ save and exit
6. Clear the original Yum Information
[Root @ localhost ~] # Yum clean all
Loaded plugins: fastestmirror
Cleaning up everything
7. Check the DVD Software List
[Root @ localhost yum. Repos. d] # Yum list
Loaded plugins: fastestmirror
Determining fastest mirrors
C6-media | 3.7 kb 00:00...
C6-media/primary_db | 3.3 MB 00:00...
In this way, the software will be installed on a DVD by default.
8. recover network installation mode, rename the CentOS-Base.repo.bak to restore, and disable local update mode with enabled = 0
Execute again:
[Root @ localhost ~] # Yum clean all
[Root @ localhost yum. Repos. d] # Yum list
PS. After the system is restarted, You need to manually mount the DVD to/Media/centos/. If you are in trouble, you can manually write a script to automatically mount it.