Yum source defaults to using the network as the Yum source, in some special cases, such as teaching, laboratory, etc., not all environments can be networked
You can use a disc to build a Yum source without using the network
We know that the disc contains all the RPM packages, so it is possible to use the CD to build a local Yum source
1. Mount the disc
<1> set up a mount point
Mkdir/mnt/cdrom
<2> Mount Disc (note virtual machines open the optical drive and select the desired image)
mount/dev/sr0/mnt/cdrom/
Or Mount/dev/cdrom/mnt/cdrom//cdrom seems to be sr0 link
2. Invalidating the network Yum source
<1> go to the Yum source directory
cd/etc/yum.repos.d/
<2> Modify the Yum source file suffix to invalidate it
MV Centos-base.repo Centos-base.repo.bak
Description
In fact, you can add enabled=0 to the Centos-base.repo file to make it effective,
But the Centos-base.repo default has 3, the modification is more cumbersome,
Therefore, by changing it to a name and adding a suffix to invalidate it
Because you may later want to install the online, it is not recommended to delete
3. Bring the disc yum source (Centos-media.repo) into effect
<1>vim Centos-media.repo #具体参数含义可以参考前面的介绍
--------------------------------------------------------------------------------------------------------------- --------------
[C6-media]
name=centos-$releasever-media
Baseurl=file:///mnt/cdrom #地址为你自己的光盘挂载地址
# File:///media/cdrom
# file:///media/cdrecorder/#注释这两个不存在的地址
Gpgcheck=1
Enabled=1 #把enabled = 0 to enabled=1, let this yum source configuration file take effect
Gpgkey=file:///ect/pki/rpm-gpg/rpm-gpg-key-centos-6 #默认就是这个, do not modify can
--------------------------------------------------------------------------------------------------------------- --------------
<2> can use the command Yum list to see which packages are installed in the Yum source to check if the Yum source is set up.
Yum List #列出的结果 its Yum source as container name
After successfully building the <3> disc yum source, you can use Yum to install the
4-2 Disc Yum Source setup