Difference between revisions of "Creating Virtual Machines on Debian"

From Supercomputación y Cálculo Científico UIS
Line 7: Line 7:
     <div class="panel panel-darker-white-border">  
     <div class="panel panel-darker-white-border">  
         <div class="panel-heading">
         <div class="panel-heading">
             <h3 class="panel-title">Creating Images</h3>
             <h3 class="panel-title">Creating Virtual Machines on Debian</h3>
         <div class="panel-body">
         <div class="panel-body">

Revision as of 20:43, 9 April 2015


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   =
        netmask   =
        broadcast =
        passwd = 1

2) Generate the image by using the following command.

xen-create-image --hostname=vm1.ve --ip= --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

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

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