[CentOS] uses discs as the Yum Software installation source

Source: Internet
Author: User

[CentOS] uses discs as the Yum Software installation source

When Linux is unable to surf the internet, but there is a need to install some software, if there is a system image ISO, then we can install some software from the CD, of course, if the CD has these software.

First insert the optical drive and mount it to the file system to

# Mount Optical Drive

Mkdir/media/cdrom

Mount/dev/cdrom/media/cdrom

Then go to Yum's Source profile path

cd/etc/yum.repo.d/

There should be many files by default in this directory, such as

Centos-base.repo

Centos-media.repo

Centos-debuginfo.repo

Centos-vault.repo

The Centos-media.repo in these files is the source associated with the optical drive, keep this file, and the other files are renamed (do not use repo as the suffix).

MV Centos-base.repo centos-base.repo.disable

MV Centos-debuginfo.repo centos-debuginfo.repo.disable

MV Centos-vault.repo centos-vault.repo.disable

At this time, the source of Yum only left the source of the optical drive, Centos-media.repo

The next step is to install the software.

#搜索安装包

Yum--enablerepo=c6-media--disableplugin=fastmirror Search Samba

#安装

Yum--enablerepo=c6-media--disableplugin=fastmirror Install samba.i686

The meaning of--enablerepo=c6-media is that the disc is enabled as a source, and C6-media is the content enclosed in brackets in the Centos-media.repo file.

--disableplugin=fastmirror means, yum is enabled by default Fastmirror this plugin, it will read the mirror list and find the fastest connection mirror as the source of the software, but we do not currently network, so we want to disable this plugin.

There is also a parameter--disablerepo=base, and--enablerepo is the opposite, refers to the specified source is disabled, if you use this parameter, the previous repo suffix renamed this step can not be done, but a repo file may have multiple repo, In that case the parameters will be longer, so the method of renaming is directly.

You can now use Yum to install a package that already exists on the CD using the commands above.

When you can go online later, change the name of the previous file back, you can.

MV Centos-base.repo.disable Centos-base.repo

MV Centos-debuginfo.repo.disable Centos-debuginfo.repo

MV Centos-vault.repo.disable Centos-vault.repo

If there is no Centos-media.repo file under the/etc/yum.repo.d/folder, just create one manually, and the contents are as follows (take CentOS-6.3 for example)

[C6-media]

name=centos-$releasever-media

baseurl=file:///media/centos/

file:///media/cdrom/

file:///media/cdrecorder/

Gpgcheck=0

Enabled=1

Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

When the installation is complete, eject the optical drive

# Stop mounting before ejecting the optical drive

Umount/media/cdrom

[CentOS] uses discs as the Yum Software installation source

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.