红联Linux门户
Linux帮助

利用Fedora 15 DVD ISO镜像制作安装源

发布时间:2014-12-18 09:51:08来源:linux网站作者:linux人

1、建立以下文件夹

[www@linux ~]$ sudo mkdir /media/dvd
[sudo] password for david:
[www@linux ~]$ sudo mkdir /media/repo/Fedora -p
[www@linux ~]$ sudo mkdir /media/repo/repodata
[www@linux ~]$


2、挂载DVD ISO镜像

[www@linux ~]$ sudo mount -r -o loop Fedora-15-i386-DVD.iso /media/dvd/
[www@linux ~]$ sudo mount –bind /media/dvd/Packages/ /media/repo/fedora/
mount: warning: /media/repo/fedora/ seems to be mounted read-only.
[www@linux ~]$


3、拷贝文件到指定目录

[www@linux ~]$ sudo cp /media/dvd/repodata/repomd.xml /media/repo/repodata/ -p


4、创建安装源

[www@linux ~]$ cd /media/repo/
[www@linux repo]$ ls
fedora  repodata
[www@linux 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@linux repo]$ cd /etc/yum.repos.d/
[www@linux yum.repos.d]$ touch iso.repo
[www@linux yum.repos.d]$ ls
iso.repo
[www@linux yum.repos.d]$ cat iso.repo
[dvd-repo]
name=dvd-repo
baseurl=file:///media/repo
enabled=1
gpgcheck=0


6、更新安装源

[www@linux ~]$ sudo yum clean all
已加载插件:langpacks, presto, refresh-packagekit
Cleaning repos: dvd-repo
清理一切
0 delta-package files removed, by presto
[www@linux ~]$ 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 …
设置更新进程
不升级任何软件包

值得注意的是,在利用此安装源的时候,就必须的移除此目录的其他文件。