当前位置: 首页 > 操作系统 > Linux > 正文

使用官方Ubuntu软件库构建DVD镜像

时间:2008-06-05 ginocic

1 Preliminary Note

This tutorial was inspired by an articles I read at http://cargol.net/~ramon/ubuntu-dvd-en. So many thanks to Ramon Acedo (the one who made this HowTo, originally)

The pages are not reachable from some weeks, now. I saved the page to read it off-line. So...

I found it useful. I hope it will be the same for you.

2 Introduction

This howto offers a simple way of creating DVD images of Debian or Ubuntu http/ftp repositories.

Ubuntu doesn't offer DVDs ready to download with its main, universe, multiverse and/or restricted repositories. With the contents of this howto you can do it yourself.

Having the Ubuntu or Debian repositories on DVD can be useful for those users who don't have access to the Internet where they have their Ubuntu installed but have access somewhere else to download the repository and build and burn the DVDs.

3 Building a local mirror

We have to install debmirror:sudo apt-get install debmirror

Now we get the Ubuntu repositories in a local directory. In the example below we get main, universe and multiverse sections of the repository in the i386 architecture.

debmirror --nosource -m --passive --host=archive.ubuntulinux.org --root=ubuntu/ --method=ftp --progress --dist=dapper --section=main,multiverse,universe --arch=i386 ubuntu/ --ignore-release-gpg

You could change the options below as you prefer:

--host - the URL of the repository.

--dist - the distro of your OS (dapper, edgy, sarge, ... ).

--section - the section you want to mirror locally.

--arch - the architecture of your box.

4 Separating the archive into DVD-sized directories

The repositories we got are too big (about 30Gb) to burn them to a DVD so we have to separate them into volumes.

The tool debpartial will do it for us.

sudo apt-get install debpartial

We make the directory where the volumes will reside.

mkdir ubuntu-dvd

and we make it to construct the package descriptors to every volume.

debpartial --nosource --dirprefix=ubuntu --section=main,universe,multiverse --dist=dapper --size=DVD ubuntu/ ubuntu-dvd/

Now we have to put the packages into the directories debpartial has just created. The script debcopy which also comes with the debpartial package will do it. The script needs ruby.

sudo apt-get install ruby

If everything is ok...

ruby debcopy ubuntu/ ubuntu-dvd/ubuntu0

ruby debcopy ubuntu/ ubuntu-dvd/ubuntu1

ruby debcopy ubuntu/ ubuntu-dvd/ubuntu2

Where ubuntu/ is the directory with the complete repository created with debmirror and ubuntu-dvd/* are the directories ready to host the new DVD-ready repository.

If we want to make soft links from the complete repository instead of copying the packages we can call debcopy with the option -l:

ruby -l debcopy ubuntu/ ubuntu-dvd/ubuntu0

ruby -l debcopy ubuntu/ ubuntu-dvd/ubuntu1

ruby -l debcopy ubuntu/ ubuntu-dvd/ubuntu2

Now every directory (ubuntu0, ubuntu1 and ubuntu2) fits on one DVD.

5 Making iso images

To get the directories ubuntu0, ubuntu1, ubuntu2 into an iso image ready to burn we can use mkisofs:

mkisofs -f -J -r -o ubuntu-dvd-0.iso ubuntu-dvd/ubuntu0

mkisofs -f -J -r -o ubuntu-dvd-1.iso ubuntu-dvd/ubuntu1

mkisofs -f -J -r -o ubuntu-dvd-2.iso ubuntu-dvd/ubuntu2

Now you can burn the iso images or mount them. Add them to the /etc/apt/source.list with the command:

sudo apt-cdrom add

Now we can verify the new repositories...

sudo apt-get update

sudo apt-get upgrade

... and, if I explain in the right way, you should have your box upgraded.