How can CentOS set DVD as the default Yum source for downloading and installing software in DVD

Time:2021-5-2

We all know that Yum is the package manager in CentOS system, which is used for software download and installation. Sometimes, for some reasons, DVD needs to be used as the default Yum source for software download and installation in DVD. The following editor will introduce how CentOS can set DVD as the default Yum source.

1. Create a mount directory for DVD

  [[email protected] ~]# mkdir /media/CentOS

2. Mounting CentOS DVD in Linux

  [[email protected] ~]# mount -t auto /dev/cdrom /media/CentOS

3. View the relevant configuration files in the directory

  [[email protected] ~]# ls -l /etc/yum.repos.d/

-rw-r–r–。 1 root July 3, 1926 10:15 CentOS base.repo

-rw-r–r–。 1 root 637 July 3 10:15 centos-debuginfo.repo

-rw-r–r–。 1 root 626 July 3 10:15 centos-media.repo

4. Disable the network update mode of yum, and simply change the default preferred CentOS base.repo to CentOS base.repo.bak

  [[email protected] yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak

5. Configure local Yum source

  [[email protected] ~]# vim /etc/yum.repos.d/CentOS-Media.repo

take

  [c6-media]

  name=CentOS-$releasever – Media

  baseurl=file:///media/CentOS/

  file:///media/cdrom/

  file:///media/cdrecorder/

  gpgcheck=1

  enabled=0

Amend to read

  [c6-media]

  name=CentOS-$releasever – Media

  baseurl=file:///media/CentOS/

  gpgcheck=1

  enabled=1

Where baseurl is changed to the DVD mount directory, enabled = 1, and local update mode is enabled

: WQ save exit

6. Clear the original Yum information

  [[email protected] ~]# yum clean all

  Loaded plugins: fastestmirror

  Cleaning up Everything

7. Check DVD software list

  [[email protected] 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 DVD installation software will be used by default. If you want to restore the network installation mode, you can rename centos-base.repo.bak and restore it.

PS. after restarting the system, you need to manually mount the DVD to / media / CentOS /. If it’s too troublesome, you can write your own script to automatically mount it.

The above is the method for CentOS to set DVD as Yum source. It can speed up the download speed of software in DVD by setting, but if you want to download from the network, you have to reset it.

Recommended Today

Large scale distributed storage system: Principle Analysis and architecture practice.pdf

Focus on “Java back end technology stack” Reply to “interview” for full interview information Distributed storage system, which stores data in multiple independent devices. Traditional network storage system uses centralized storage server to store all data. Storage server becomes the bottleneck of system performance and the focus of reliability and security, which can not meet […]