1. Mount the disc
Mount /dev/cdrom/media/cdrom/Mount:/dev/sr0 write-protected, mount as read-only
The CDROM directory under/dev is created in advance
2. Modify Yum configuration file (file location:/ETC/YUM.REPOS.D)
[Email protected]/]# cd/etc/Yum. repos.d/[[Email protected]Yum. repos.d]#mkdirbak #创建一个文件夹来存放多余的配置文件 [[email protected]Yum. repos.d]#MV* * bak/[[Email protected]Yum. repos.d]# CD bak/[email protected] bak]#lsCentOS-base.repo Centos-debuginfo.repo Centos-media.repo centos-Vault.repocentos-cr.repo Centos-fasttrack.repo centos-Sources.repo[[email protected] bak]#MVCentos-media.repo. /[email protected] bak]# CD ./[[Email protected]Yum. repos.d]#VICentos-media.repo
# centos-media.repo## This repo can is used with mounted DVD Media, verify theMountPoint for# CentOS-7. can use this repo andYumToInstallitems directly off the# DVD ISO that we release.## to use this repo, putinchyour DVD and use it with the other repos too:#Yum--enablerepo=c7-Media [command]## or forOnly the media repo, Dothis:##Yum--disablerepo=\*--enablerepo=c7-Media [Command][c7-Media]name=centos-$releasever-Mediabaseurl=file:///media/centos/ file:///media/cdrom/#本地yum源所在路径 file:///media/cdrecorder/gpgcheck=0 #这里为0不进行检查enabled=1 #这里为1 StartGpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7~
Save exit
3. Verification
We can view the warehouse with the Yum command plus the list parameter
[email protected]/]# Yum list #后面东西太多了 ...
How Linux builds local yum warehouses by mounting the system CD