Build a CD yum source

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/young2415/article/details/89740974


yum can easily install software online to help us, but sometimes Linux may even not online, this time, if the local CD-ROM as a source of yum, the same can easily use the yum command. This article will tell you how to build a CD yum source.

The first step to mount CD

[root@localhost cdrom]# mount /dev/sr0 /mnt/cdrom

If you are not familiar with some small partners mount the CD, you can refer to the article: Linux network commands .

The second step allows network failure yum source file

All yum configuration files are placed in the source /etc/yum.repos.ddirectory:
Here Insert Picture Description

By default, this is CentOS-Base.repo network yum source file to take effect, if you want the CD as a source yum, you have to let the CentOS-Media.repo entry into force of this file, and let the other documents fail. There are several ways to achieve this:

  1. Other options set to enable yum source file to 0
  2. Other yum delete source files
  3. Other changes to the source file name yum

The first approach to open each file one by one due to the change which enable the option, it is more troublesome; but if you take the second approach, then later have to be used in case of network yum source, we will have to manually configure, so the second ways nor desirable. So only the third choice.

Specific approach is, in other files behind the file name plus ".bak" because LInux is to identify the source file through yum ".repo" suffix, so the file extension change it, you can make yum source file fails the theory can also be changed to another name, but add a ".bak" extension can easily see the name to know Italian.

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

The third step is to modify the source file CD yum

The /etc/yum.repos.d/CentOS-Media.repocontents of the file into the following way:
Here Insert Picture Description

After completion of file modification, execution yum list, if you see the name of the back of the container is yum c6-media, it shows on CD yum source to build success.
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/young2415/article/details/89740974