Difference between revisions of "Debian Guest Installation Using Debian Installer"

From Xen
m
(Initial information on acquiring a Debian ISO image suitable for installing a PV guest.)
Line 76: Line 76:
 
=CD-ROM installation=
 
=CD-ROM installation=
   
  +
==Selecting a CD/DVD/BD ISO image==
''TBD''
 
  +
  +
Full support for installing a Xen PV guest (32 or 64 bit) from an ISO image was added to Debian in the Squeeze (6.0.0) release.
  +
  +
Downloads of Debian CD images are available from the [http://www.debian.org/CD/ Debian CD Image] site. Several options are available for downloading, it is preferred to use [http://atterer.org/jigdo/ jigdo] (a tool which can reconstitute an ISO image from a Debian mirror) or [http://bitconjurer.org/BitTorrent/ BitTorrent] rather than direct download of ISO (which may be throttled or otherwise slower). More info on downloading using jigdo is available on the [http://www.debian.org/CD/jigdo-cd/ Debian CD Jigdo] page.
  +
  +
Debian provides several different flavours of the first ISO image, only some of which support installation as a Xen PV guest. The main two flavours which support Xen PV are:
  +
  +
* ''multi-arch (i386 & amd64) netinst CD Images'' of [http://www.debian.org/releases/squeeze/ Debian Squeeze 6.0.4] ([http://cdimage.debian.org/debian-cd/6.0.4/multi-arch/jigdo-cd/debian-6.0.4-amd64-i386-netinst.jigdo jigdo],[http://cdimage.debian.org/debian-cd/6.0.4/multi-arch/bt-cd/debian-6.0.4-amd64-i386-netinst.iso.torrent torrent])
  +
* ''multi-arch (i386, amd64 & source) DVD Images'' of [http://www.debian.org/releases/squeeze/ Debian Squeeze 6.0.4] ([http://cdimage.debian.org/debian-cd/6.0.4/multi-arch/jigdo-dvd/debian-6.0.4-i386-amd64-source-DVD-1.jigdo jigdo],[http://cdimage.debian.org/debian-cd/6.0.4/multi-arch/bt-dvd/debian-6.0.4-i386-amd64-source-DVD-1.iso.torrent torrent])
  +
  +
In both cases the image supports installation of both 32 bit (i386) and 64 bit (amd64) Debian guests.
  +
  +
Information on verifying the authenticity of these images is available [http://www.debian.org/CD/verify here].
  +
  +
If the machine on which you want to install guests has a network connection then the ''netinst'' option is preferable since it reduces the initial download and will then only download precisely what you need for your configuration. Note that if you have a network connection then booting a ''netboot'' image (as described above) is an even better option.
  +
  +
Having selected the appropriate first ISO you can then combine this with the images from the standard set in order to make up a complete set of Debian packages installable from ISO.
  +
  +
In addition to the above stable release images there are daily builds of ''multi-arch netinst CD'' images ([http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/multi-arch/jigdo-cd/debian-testing-amd64-i386-netinst.jigdo jigdo],[http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/multi-arch/bt-cd/debian-testing-amd64-i386-netinst.iso.torrent torrent]) and weekly builds of the ''multi-arch DVD'' images ([http://cdimage.debian.org/cdimage/weekly-builds/multi-arch/jigdo-dvd/debian-testing-i386-amd64-source-DVD-1.jigdo jigdo], [http://cdimage.debian.org/cdimage/weekly-builds/multi-arch/bt-dvd/debian-testing-i386-amd64-source-DVD-1.iso.torrent torrent]) for the [http://www.debian.org/releases/testing/ testing] release. Note that the ''testing'' release of Debian is by definition a work in progress and may contain transient issues etc.
   
 
=Advanced Options=
 
=Advanced Options=
Line 82: Line 101:
 
==Preseeding==
 
==Preseeding==
   
You can preseed a Xen installation in the same way as a normal native install by adding the necessary directives to the ''extra'' configuration line. e.g.
+
You can preseed a Xen installation in the same way as a normal native install by adding the necessary command line directives to the ''extra'' configuration line. e.g.
   
 
extra = "debian-installer/exit/always_halt=true -- console=hvc0 auto-install/enable=true url=http://example.com/debian/squeeze.cfg"
 
extra = "debian-installer/exit/always_halt=true -- console=hvc0 auto-install/enable=true url=http://example.com/debian/squeeze.cfg"

Revision as of 10:03, 23 April 2012

Debian Installer

Debian Installer is the standard installer used to install Debian on native systems. Debian Installer has supported netboot installation of Xen as a PV guests (both i386 and amd64) since Lenny (Debian 5.0) was released and has supported CD-ROM (and DVD, Blu-Ray etc) installations since Squeeze (Debian 6.0).

The main benefit of using Debian Installer to install a Xen guest is that you are able to use all the technologies (like pre-seeding) which you are used to using on a native system. You also end up with an installed system which is as similar as possible to a native Debian system installed via the same mechanisms. Installing a Xen guest Debian Installer produces a fully configured Debian system without the need to setup things such as /etc/fstab by hand.

Netboot installation

A netboot installation is a quick and easy way to install Debian. You start by downloading a small (approximately 20MB) installer kernel and initrd which you boot as a PV guest. After this Debian Installer will take over and you can install the guest direct from the network. If you are only installing a single guest this has the advantage of only downloading exactly what is needed for the installation. If you are installing lots of guests then you may find it beneficial to create a local mirror (which will require a large initial bandwidth investment) or install a caching proxy such as apt-cacher to reduce the number of external downloads.

Select A Mirror

If you are not using your own mirror or a tool such as apt-cacher then you will need to choose a nearby mirror from Debian's list of worldwide mirrors. In general you should select the mirror which is nearest to you. Alternatively you can simply use the (unofficial) http://cdn.debian.net service to automatically select a nearby mirror.

The following instructions assume that you are using http://cdn.debian.net, substitute the mirror which you have selected or the name of your apt-cacher/mirror machine as appropriate.

Download Debian Installer Images

Once you have selected a mirror then you can download the Debian Installer kernel and initrd. You only need to do this once since you can reuse the same images multiple times.

Download both vmlinuz and initrd.img from here (amd64) or here (i386) and save them to your Xen system. This guide assumes you have put them in /scratch/debian/squeeze/amd64 and /scratch/debian/squeeze/i386 respectively.

These instructions assume you are installing Debian Squeeze. However you can modify the URLs to point to any release from Lenny onwards.

Create Initial Guest Configuration

For the initial boot you should configure the guest to use the vmlinux and initrd.gz which you downloaded above and with a command line suitable for using the installer. e.g.

kernel = "/scratch/debian/squeeze/amd64/vmlinuz"
ramdisk = "/scratch/debian/squeeze/amd64/initrd.gz"
extra = "debian-installer/exit/always_halt=true -- console=hvc0"

The rest of the guest configuration is down to you and your requirements for the guest you are installing. You would normally want to configure a disk and network device as normal. A network device with external connectivity (or connectivity to your local mirror/cache) is required for the duration of the installation process.

In order to use Debian Installer it is necessary to use the whole disk disk configuration rather than the partitions. In other words you must configure an xvda device and not xvda1, xvda2 etc. For example a complete (if rather minimal) installation time configuration might be:

name = "debian-installer"

memory = 256

disk = ['phy:/dev/VG/debian-installer,xvda,w']
vif = [' ']

kernel = "/scratch/debian/squeeze/amd64/vmlinuz"
ramdisk = "/scratch/debian/squeeze/amd64/initrd.gz"
extra = "debian-installer/exit/always_halt=true -- console=hvc0"

At this point you should create the backing storage for the disk configuration you are using. e.g. in this case:

# lvcreate -L 4G -n debian-installer /dev/VG

See Xen Man Pages for more details of the guest configuration syntax.

Install Debian

Now that you have created the guest configuration you can start the guest and connect to its console. e.g. assuming your guest configuration file is /etc/xen/debian-installer.cfg:

# xl create -c /etc/xen/debian-installer.cfg

At this point the guest will boot and Debian Installer will start. Now you can install Debian like you normally would, perhaps following the Debian Installation Guide.

See Xen Man Pages for more details on the use of xl

Finalize Guest Configuration

Once installation has completed the guest will shutdown and exit. At this point you should remove the kernel, initrd and extra lines from the guest configuration and replace them with simply:

bootloader = "pygrub"

Keep the rest of the configuration file the same.

Now you can start the guest again to boot your newly installed Debian guest!

# xl create -c /etc/xen/debian-installer.cfg

CD-ROM installation

Selecting a CD/DVD/BD ISO image

Full support for installing a Xen PV guest (32 or 64 bit) from an ISO image was added to Debian in the Squeeze (6.0.0) release.

Downloads of Debian CD images are available from the Debian CD Image site. Several options are available for downloading, it is preferred to use jigdo (a tool which can reconstitute an ISO image from a Debian mirror) or BitTorrent rather than direct download of ISO (which may be throttled or otherwise slower). More info on downloading using jigdo is available on the Debian CD Jigdo page.

Debian provides several different flavours of the first ISO image, only some of which support installation as a Xen PV guest. The main two flavours which support Xen PV are:

In both cases the image supports installation of both 32 bit (i386) and 64 bit (amd64) Debian guests.

Information on verifying the authenticity of these images is available here.

If the machine on which you want to install guests has a network connection then the netinst option is preferable since it reduces the initial download and will then only download precisely what you need for your configuration. Note that if you have a network connection then booting a netboot image (as described above) is an even better option.

Having selected the appropriate first ISO you can then combine this with the images from the standard set in order to make up a complete set of Debian packages installable from ISO.

In addition to the above stable release images there are daily builds of multi-arch netinst CD images (jigdo,torrent) and weekly builds of the multi-arch DVD images (jigdo, torrent) for the testing release. Note that the testing release of Debian is by definition a work in progress and may contain transient issues etc.

Advanced Options

Preseeding

You can preseed a Xen installation in the same way as a normal native install by adding the necessary command line directives to the extra configuration line. e.g.

extra = "debian-installer/exit/always_halt=true -- console=hvc0 auto-install/enable=true url=http://example.com/debian/squeeze.cfg"

More information on preseeding can be found in Appendix B of Debian's Installation Guide

Other Installation Methods

Debian's Xen wiki page covers several other methods of installing Xen guests, including debootstrap and xen-tools.