Linux system, set up a local CD yum source

Setting up a local CD yum source

  • Step: CentOS installation into the disc, and the disc mount to the specified location; command is as follows:
[root@localhost ~]#mkdir /mnt/cdrom
#创建cdrom目录,作为光盘的挂载点
[root@localhost ~]#mount -t iso9660 /dev/cdrom1 /mnt/cdrom/
mount: block device /dev/sr0 is write-protected mounting read-only
#挂载光盘到/mnt/cdrom目录下
  • Step Two: New bak directory, * .repo file to the backup folder backup, because only the extension is "* .repo" yum source file to a configuration file. Of course, you can also delete a few other yum source profile, but if you delete, when you want to use the network as a source yum, there is no reference file. Command is as follows:
[root@localhost ~]#cd /etc/yum.repos.d/
[root@localhost yum.repos.d]#mv *.repo /backup/
  • The third step: modifying the source profile disc yum CentOS-Media.repo, with reference to the following modified method:
[root@localhost ~]# vim /etc/yum.repos.d/backup/CentOS-Media.repo
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS_6.6_Final/
        file:///media/cdrom/
        file:///dev/cdrom1
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  • Step four: Clear the cache yum
[root@localhost yum.repos.d]# yum clean all
已加载插件:fastestmirror, refresh-packagekit, security
Cleaning repos: demo
清理一切
  • Step five: the package information is downloaded to the local computer server cached
[root@localhost yum.repos.d]# yum makecache
已加载插件:fastestmirror, refresh-packagekit, security
Determining fastest mirrors
demo                                                                                   
| 4.0 kB     00:00 ... demo/group_gz                                                     | 216 kB     00:00 ... demo/filelists_db
| 6.0 MB     00:00 ... demo/primary_db
| 4.5 MB     00:00 ... demo/other_db                                                   | 2.8 MB     00:00 ... 
元数据缓存已建立

Guess you like

Origin blog.51cto.com/9664355/2452408