I am interested in trying out Xen;
- What packages do I need to install?
- How do I set up a DomU instance?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
I am interested in trying out Xen;
Paravirtualized guest and Ubuntu 11.04
When installing a Xen virtual machine, you need to determine what kind of block devices you want to work with. There are three possibilities: installing directly on a dedicated partition (maximum performance) or by using an important disk image file or create your own disk image file with dd (resizable; You can use snapshots for making backups)
All commands assume
sudo su). I also assume using LVM but have also included an untested method where you use
dd to use your own image. So skip 1 if you want to use a file (and not LVM) and skip 2 if you do use LVM.
Create a new LVM volume for your virtual machine. Change the name (after
-n) to suit your needs:
lvcreate -L10G -n example.ubuntu.natty VolumeGroup
lvcreate is part of lvm2 but it is already installed when you are using lvms.
You can also use a file (
dd). I have not found a suitable method for this with Ubuntu but this should come close. If you go with this I have experience with it but all the next steps should be the same. Copied from the link the method to create one using
dd (the link also includes other methods of getting a file):
Create a 4Gb empty file with at
/var/lib/xen/images/disk1 (change either size and location to fit your needs):
dd if=/dev/zero of=/var/lib/xen/images/disk1 bs=1M count=4096
Apart from creating empty image files using the dd utility, you can also use ISO files as an alternative for your physical optical drives. The usage is the same as the usage of a disk image file created with dd. Don't have an ISO file yet? Then we have good news for you; it's easy to create one. If the cd-rom of which you want to create an ISO file is in your optical drive, use the following to copy it to a file with the name cdrom.iso:
dd if=/dev/cdrom of=/isos/cdrom.iso
After creating either a disk image file or an ISO file, you need to include the disk image file in your virtual machine configuration using the file option in the disk definition:
disk=[ 'file:/var/lib/xen/images/disk1,hda,w', 'file:/isos/cdrom.iso,hdc,r', ]
wget versions for
installer-amd64 (so change the country code
nl and also use
installer-amd64 in the URL to fit your needs):
wget http://nl.archive.ubuntu.com/ubuntu/dists/natty/main/installer-i386/current/images/netboot/xen/xm-debian.cfg wget http://nl.archive.ubuntu.com/ubuntu/dists/natty/main/installer-i386/current/images/netboot/xen/initrd.gz wget http://nl.archive.ubuntu.com/ubuntu/dists/natty/main/installer-i386/current/images/netboot/xen/vmlinuz
Edit the config file
Edit the config file to taste, paying attention to the memory, name, vcpus, vif, and disk options. Also, find the line that says
bootloader=pygrub and change it to the absolute path
Start the install (again pay attention to the command: change server country code and architecture to your needs):
xm create -f xm-debian.cfg -c install=true install-kernel="vmlinuz" install-ramdisk="initrd.gz" install-mirror="http://nl.archive.ubuntu.com/ubuntu" install-arch=i386 install-method=network
back, drop to a
shelland issue a
modprobe xen-netfront && exit. Configure the network card again.
and it starts installing.
Fix the install.
xen-blkfront module isn’t loaded at first so
xen will fail to boot.
(initframfs) modprobe xen-blkfront (initramfs) exit
Once the host finishes booting, log in and sudo to root. Then enter the following:
echo "xen-blkfront" >> /etc/initramfs-tools/modules update-initramfs -u update-initramfs: Generating /boot/initrd.img-2.6.38-11-generic
Untested and from memory + googling to fix my memory