How does CentOS set the DVD as the default yum source

  
                

We all know that yum is a package manager in the CentOS system for downloading and installing software. Sometimes for some reason, you need to use DVD as the default yum source for downloading and installing software on DVD. Let me introduce how CentOS is built as a default yum source.

1, DVD to create a mount directory

[root @ localhost ~] # mkdir /media /CentOS

2, mounted under Linux CentOS DVD (virtual machine mount DVD does not say, should be)

[root@localhost ~]# mount -t auto /dev/cdrom /media/CentOS

3, view related configuration File, directory is

[root@localhost ~]# ls -l /etc/yum.repos.d/

-rw-r--r--. 1 root root 1926 July 3 10:15 CentOS-Base.repo

-rw-r--r--. 1 root root 637 July 3 10:15 CentOS-Debuginfo.repo

-rw-r--r--. 1 root root 626 July 3 10:15 CentOS-Media.repo

4, disable yum network update method, simply rename the default preferred CentOS-Base.repo to CentOS-Base.repo.bak

[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak

5, configure local yum source

[root@localhost ~]# vim /etc/yum.repos.d/CentOS-Media.repo

Will

[c6-media]

name=CentOS- $releasever - Media

baseurl=file:///media/CentOS/

file:///media/cdrom/

file:///media/cdrecorder /

gpgcheck=1

enabled=0

Modified to

[c6-media]

name=CentOS-$releasever - Media

baseurl=file:///media/CentOS/

gpgcheck=1

enabled=1

where baseurl is modified to hang on DVD Contains directory, enabled=1 turns on local update mode

:wq saves exit

6, clears 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

Copyright © Windows knowledge All Rights Reserved