1、建立以下文件夹
[@linuxidc ~]$ sudo mkdir /media/dvd
[sudo] password for david:
[@linuxidc ~]$ sudo mkdir /media/repo/Fedora -p
[@linuxidc ~]$ sudo mkdir /media/repo/repodata
[@linuxidc ~]$
2、挂载DVD ISO镜像
[@linuxidc ~]$ sudo mount -r -o loop Fedora-15-i386-DVD.iso /media/dvd/
[@linuxidc ~]$ sudo mount –bind /media/dvd/Packages/ /media/repo/fedora/
mount: warning: /media/repo/fedora/ seems to be mounted read-only.
[@linuxidc ~]$
3、拷贝文件到指定目录
[@linuxidc ~]$ sudo cp /media/dvd/repodata/repomd.xml /media/repo/repodata/ -p
4、创建安装源
[@linuxidc ~]$ cd /media/repo/
[@linuxidc repo]$ ls
fedora repodata
[@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、添加安装源
[@linuxidc repo]$ cd /etc/yum.repos.d/
[@linuxidc yum.repos.d]$ touch iso.repo
[@linuxidc yum.repos.d]$ ls
iso.repo
[@linuxidc yum.repos.d]$ cat iso.repo
[dvd-repo]
name=dvd-repo
baseurl=file:///media/repo
enabled=1
gpgcheck=0
6、更新安装源
[@linuxidc ~]$ sudo yum clean all
已加载插件:langpacks, presto, refresh-packagekit
Cleaning repos: dvd-repo
清理一切
0 delta-package files removed, by presto
[@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 …
设置更新进程
不升级任何软件包
值得注意的是,在利用此安装源的时候,就必须的移除此目录的其他文件。