Creating a Xen Virtual Machine

  1. apprentice@xenserver:~$ time sudo xen-create-image --pygrub --fs=ext4 --install=1 --memory=2048M --arch=amd64 --passwd --vcpus=1 --bridge=xenbr0 --mac=02:04:66:55:44:01 --nameserver=129.125.4.6 --vifname=vif1 --gateway=10.0.17.253 --netmask=255.255.255.0 --lvm=vgvhosts --size=9728M --swap=512M --install-method=debootstrap --mirror=http://osmirror.rug.nl/debian --dist=wheezy --hostname=vhost1 --ip=10.0.17.1 --boot

    Let's see that again, in more readable format:

    time sudo xen-create-image \
      --pygrub --fs=ext4 --install=1 \
      --memory=2048M --arch=amd64 --vcpus=1 --passwd \
      --bridge=xenbr0 --mac=02:04:66:55:44:01 --nameserver=129.125.4.6 --vifname=vif1 --gateway=10.0.17.253 --netmask=255.255.255.0 \
      --lvm=vgvhosts --size=9728M --swap=512M \
      --install-method=debootstrap --mirror=http://osmirror.rug.nl/debian --dist=wheezy \
      --hostname=vhost1 --ip=10.0.17.1 \
      --boot

    [Note]Note

    This command does ask you for a password. For now, I'm fine with that.

  2. The config needs a small fix:

    apprentice@xenserver:~$ sudo sed -i 's/2048M/2048/g' /etc/xen/vhost1.cfg

    Then we can start the domain:

    apprentice@xenserver:~$ sudo xm create /etc/xen/vhost1.cfg 
    Using config file "/etc/xen/vhost1.cfg".
    Started domain vhost1 (id=2)

  3. Yes it does:

    apprentice@xenserver:~$ sudo xm console vhost1


    Debian GNU/Linux 7 vhost1 hvc0

    vhost1 login: root
    Password: 
    Last login: Thu Nov  7 16:35:55 CET 2013 on hvc0
    <snip>
    root@vhost1:~# apt-get update
    Hit http://osmirror.rug.nl wheezy Release.gpg
    Hit http://osmirror.rug.nl wheezy Release
    <snip>

    (You can use tcpdump to verify that traffic on eth0 of dom0 doesn't appear of eth0 of domU.)