Creating Virtual Machines on Debian

From Supercomputación y Cálculo Científico UIS


Back to Xen on Debian

Creating Virtual Machines on Debian

1) Edit the /etc/xen-tools/xen-tools.conf file and put the configuration you like to. Example:

File: /etc/xen-tools/xen-tools.conf
        dir = /home/xen
        install-method = debootstrap
        size   = 4Gb      # Disk image size.
        memory = 1024Mb    # Memory size
        swap   = 1024Mb    # Swap size
        fs     = ext3     # use the EXT3 filesystem for the disk image.
        dist   = lenny     # Default distribution to install.
        image  = sparse   # Specify sparse vs. full disk images.
        kernel      = /boot/vmlinuz-`uname -r`
        initrd      = /boot/initrd.img-`uname -r`
        mirror = http://ftp.us.debian.org/debian/
        ext3_options   = noatime,nodiratime,errors=remount-ro
        gateway   = 192.168.100.1
        netmask   = 255.255.255.0
        broadcast = 192.168.100.255
        passwd = 1

2) Generate the image by using the following command.

xen-create-image --hostname=vm1.ve --ip=192.168.100.80 --arch=amd64 --role=udev


NOTE: The last script does not take on count some details, is necessary to fix them

3) Edit the /etc/xen/vm1.cfg file and modify the following lines for looking like this

File: /etc/xen/vm1.ve.cfg
        root = '/dev/sda2 ro console=/dev/hvc0'
        vif  = [ 'bridge=eth0' ]

4) Mount the image

mount -o loop /home/xen/domains/vm1.ve/disk.img /mnt


5) Edit the file /mnt/etc/inittab and change the line

File: /mnt/etc/inittab
        1:2345:respawn:/sbin/getty 38400 tty1

And make it to look like this

File: /mnt/etc/inittab
        1:2345:respawn:/sbin/getty 38400 hvc0

6) Edit the /mnt/etc/securetty file and add to the end of the line

File: /mnt/etc/securetty
        hvc0

7) For booting the virtual machine run the following command:

xm create -c /etc/xen/vm1.platino.gov.ve.cfg