1. Mount CD
[Root@localhost ~]# mount/dev/cdrom/media/cdrom/
Mount:/dev/sr0 write-protected, will be mounted as read-only
The CDROM directory under/dev is created in advance.
2. Modify Yum configuration file (file location:/ETC/YUM.REPOS.D)
[Root@localhost/]# cd/etc/yum.repos.d/[root@localhost yum.repos.d]# mkdir bak #创建一个文件夹来存放多余的配置文件 [root@localhost yu m.repos.d]# mv *.* bak/[root@localhost yum.repos.d]# cd bak/[root@localhost bak]# ls Centos-base.repo CentOS-Debug Info.repo Centos-media.repo Centos-vault.repo centos-cr.repo Centos-fasttrack.repo CentOS-Sources.repo [ Root@localhost bak]# MV Centos-media.repo. /[Root@localhost bak]# CD ... /[Root@localhost yum.repos.d]# VI Centos-media.repo # centos-media.repo # This repo can is used with mounted DVD Media , verify the mount point for # CentOS-7.
You can use this repo and yum to install items directly off the # DVD ISO so we release. # To use this repo, put on your DVD and use it with the other repos too: # yum--enablerepo=c7-media [command] # # or FO R only the media repo, does this: # # yum--disablerepo=\*--enablerepo=c7-media [command] [C7-media] name=centos-$releaseve R-media baseurl=file:///media/centos/file:///media/cdrom/#本地yum源所在路径 file:///media/cdrecorder/gpgcheck=0 #这里为0不进行检查 enabled=1 #这里为1 start gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7 ~
Save exit
3. Verify
We can view the warehouse using the Yum command plus the list parameter.
[Root@localhost/]# yum list #后面东西太多了 ...
The above is a small set to introduce Linux through the mounting system CD-ROM to build local Yum warehouse method, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!