Use centos DVD as the default Yum Source

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.