1、建立以下文件夹
[www.linuxidc.com@linuxidc ~]$ sudo mkdir /media/dvd
[sudo] password for david:
[www.linuxidc.com@linuxidc ~]$ sudo mkdir /media/repo/Fedora -p
[www.linuxidc.com@linuxidc ~]$ sudo mkdir /media/repo/repodata
[www.linuxidc.com@linuxidc ~]$
2、挂载DVD ISO镜像
[www.linuxidc.com@linuxidc ~]$ sudo mount -r -o loop Fedora-15-i386-DVD.iso /media/dvd/
[www.linuxidc.com@linuxidc ~]$ sudo mount –bind /media/dvd/Packages/ /media/repo/fedora/
mount: warning: /media/repo/fedora/ seems to be mounted read-only.
[www.linuxidc.com@linuxidc ~]$
3、拷贝文件到指定目录
[www.linuxidc.com@linuxidc ~]$ sudo cp /media/dvd/repodata/repomd.xml /media/repo/repodata/ -p
4、创建安装源
[www.linuxidc.com@linuxidc ~]$ cd /media/repo/
[www.linuxidc.com@linuxidc repo]$ ls
fedora repodata
[www.linuxidc.com@linuxidc repo]$ sudo createrepo -g repodata/repomd.xml .
Spawning worker 0 with 2943 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
5、添加安装源
[www.linuxidc.com@linuxidc repo]$ cd /etc/yum.repos.d/
[www.linuxidc.com@linuxidc yum.repos.d]$ touch iso.repo
[www.linuxidc.com@linuxidc yum.repos.d]$ ls
iso.repo
[www.linuxidc.com@linuxidc yum.repos.d]$ cat iso.repo
[dvd-repo]
name=dvd-repo
baseurl=file:///media/repo
enabled=1
gpgcheck=0
6、更新安装源
[www.linuxidc.com@linuxidc ~]$ sudo yum clean all
已加载插件:langpacks, presto, refresh-packagekit
Cleaning repos: dvd-repo
清理一切
0 delta-package files removed, by presto
[www.linuxidc.com@linuxidc ~]$ sudo yum update
已加载插件:langpacks, presto, refresh-packagekit
dvd-repo | 3.6 kB 00:00 …
dvd-repo/primary_db | 2.1 MB 00:00 …
dvd-repo/group | 3.7 kB 00:00 …
设置更新进程
不升级任何软件包
值得注意的是,在利用此安装源的时候,就必须的移除此目录的其他文件。