Use CentOS DVD as the default yum Source

Source: Internet
Author: User

Environment: CentOS 6.0

By default, yum is installed on the network. It is very painful to install software using yum without network or poor network speed. In fact, for CentOS DVD, the software provided in it is enough to meet our needs, and the software versions in the DVD are stable versions, and the download speed is still fast. For Learning CentOS, using CentOS DVD as the default yum source can greatly improve learning efficiency.

1. Create a mount directory for the DVD

[Root @ localhost ~] # Mkdir/media/CentOS

2. Mount CentOS DVDs in Linux (virtual machines should not mount DVDs anymore)

[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 July 3 10:15 CentOS-Base.repo
-Rw-r --. 1 root 637 July 3 10:15 CentOS-Debuginfo.repo
-Rw-r --. 1 root 626 July 3 10:15 CentOS-Media.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 case, the software is installed on the DVD by default. If you want to restore the network installation mode, rename the CentOS-Base.repo.bak.

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.

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.