疑问:如果没有网络,沒有光驅,網絡較慢等,如何使用yum源? 答案:使用本地ISO搭建yum源 本地ftp,http源,epel源,後續補充 1,創建ISO存放目錄、掛載點 ~]# mkdir /mnt/iso ~]# mkdir /mnt/iso_mount 2,自動掛載并啟動掛載點 ~]# echo "/mnt/iso.iso /mnt/iso_mount iso9660 loop 0 0" >> /etc/fstab ~]# mount -a ~]# mount | grep .iso /mnt/iso/iso.iso on /mnt/iso_mount type iso9660 (rw,loop=/dev/loop0) 3,創建yum 源 cp /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Iso.repo CentOS-Base.repo改名 yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak 備份創建光盤repo配置文件,名稱可自取配置文件,名稱可自取 yum.repos.d]# cp CentOS-Media.repo CentOS-Media.repo.bak 修改repo配置文件,名稱可自取 yum.repos.d]# vim CentOS-Media.repo # CentOS-Media.repo # # This repo can be used with mounted DVD media, verify the mount point for # CentOS-6. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c6-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c6-media [command] [c6-iso] name=CentOS-$releasever - ISO baseurl=file:///mnt/iso_mount/ # file:///media/cdrom/ # file:///media/cdrecorder/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 加載yum源 ~]# yum clean all ~]# yum repolist Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile c6-iso | 4.0 kB 00:00 ... repo id repo name status c6-iso CentOS-6 - ISO 6,367 repolist: 6,367
转载于:https://blog.51cto.com/jameszhan/2324194