Setting Up Xen DomU on Fedora: Unmodified Fedora 12 on Top of Xenified Fedora 12 Xen Dom0

By Zhiqiang Ma On Nov 29, 2012

Creating file-backed virtual block device (VBD) for Xen virtual machines and installing Fedora 12 in Xen DomU via internet will be introduced.

The Dom0 platform on top of which this DomU is set up is introduced also in this site. Please refer to

Xen solution

for the latest stable Xen Dom0 solution.

Create file-backed VBD:

The actual space of VBD will be the amount of disk the virtual machine used. And it will be convenient if the virtual machine will be duplicated since the work is just copying the VBD file and changing some configurations. But file-backed VBDs may not be appropriate for I/O-intensive domains because of the I/O handling cost to support file-backed VBDs in dom0. Create a 20GB sparse file-backed VBD:
# dd if=/dev/zero of=/lhome/xen/f12install/vmdisk0 bs=1k seek=20480k count=1

Install Fedora 12 Linux via Internet

First download the pxeboot kernel of Fedora 12 for installation via Internet. Download vmlinuz and initrd.img from here:
http://download.fedora.redhat.com/pub/fedora/linux/releases/12/Fedora/x8664/os/images/pxeboot/
As Fedora 12 is not updated by Fedora any more. The repository is moved to archive site:
http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/x8664/os/images/pxeboot/
The kernel and memory image can be downloaded directly by:
$ wget http://download.fedora.redhat.com/pub/fedora/linux/releases/12/Fedora/x8664/os/images/pxeboot/vmlinuz $ wget http://download.fedora.redhat.com/pub/fedora/linux/releases/12/Fedora/x8664/os/images/pxeboot/initrd.img
$ wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/x8664/os/images/pxeboot/vmlinuz
$ wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/x8664/os/images/pxeboot/initrd.img
We assume these two files are stored in /lhome/xen/f12install/.

Create an installation profile f12.install:

name="F12INSTALL"
vcpus=2
memory=2048
disk = ['file:/lhome/xen/f12install/vmdisk0,xvda,w' ]
vif = [ 'bridge=eth0' ]
kernel = "/lhome/xen/f12install/vmlinuz"
ramdisk = "/lhome/xen/f12install/initrd.img"
onreboot = 'restart'
oncrash = 'restart'
The virtual machine’s name is “F12INSTALL”, memory is 2G, CPU number is 2, disk, kernel and ramdisk is prepared in the above steps.

Start this virtual machine and connect to this virtual machine’s console and complete the installation:

# xm create -c f12.install
The console can be released by “Ctrl+]”. And it can be reconnected by:
# xm console F12INSTALL
The installation of Fedora 12 will start. The gateway and DNS server should be set according to the network configuration.

The URL of installation source I used during installation is:

http://download.fedora.redhat.com/pub/fedora/linux/releases/12/Fedora/x8664/os/
http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/x8664/os/
After successfully installation of this virtual machine. It can be shut down by:
# xm shutdown F12INSTALL
This virtual machine can be duplicated to get more VMs: How to duplicate Xen DomU virtual machines.

Start DomU

Remember to update your system after the first boot. The 2.6.32 kernel is more stable running as DomU than the default one.

Create a profile vm-10.0.0.123.run for loading the virtual machine:

name="10.0.0.123"
vcpus=2
memory=2048
disk = ['file:/lhome/xen/vm-10.0.0.123/vmdisk0,xvda,w' ]
vif = [ 'bridge=eth0' ]
bootloader = "/usr/bin/pygrub"
onreboot = 'restart'
oncrash = 'restart'
Here we use the PyGrub (“/usr/bin/pygrub”) as the bootloader. PyGrub starts Linux DomUs with the kernels that lie in the filesystem of the DomU instead of the kernels that lie in the filesystem of the Dom0. That makes the kernel update and management easier.

Then the DomU can be started using this profile:

# xm create vm-10.0.0.123.run
The console of this DomU can be connected to:
# xm console vm-10.0.0.123
Update history: Mar. 29, 2010. Change the URL of fedora repository to archive site. Aug. 2, 2010. Add link to setting up Dom0. Aug. 16, 2010. Add link to very stable Dom0 solution. Aug 27, 2010. file:// driver is recommended for installation. Sep. 28, 2010. No need to create ext3 FS after creating the image. Aug. 13, 2011. Not suggestion tap:aio. It is not stable enough.

By: Zhiqiang Ma Last updated: Nov 29, 2012 Views: 5,030
Tags: , ,

About Zhiqiang Ma

Zhiqiang Ma is a PhD candidate at Dep. of CSE, HKUST. He is interested in system software for cloud computing, virtualization of large-scale distributed system, etc. Find Zhiqiang on Facebook, Twitter, LinkedIn and Google+.

10 Comments on Setting Up Xen DomU on Fedora: Unmodified Fedora 12 on Top of Xenified Fedora 12 Xen Dom0 | Add Comment
  • “Start DomU
    Remember to update your system after the first boot.”

    (1)Q1:
    Does it mean we had better update host PC’s fedora? Or guest VM’s fedora?
    (2)Q2:
    Maybe “after” should be changed to “before”?

  • When creating vm,there are definitions for kernel and ramdisk in installation file-f12.install.
    [...
    kernel = "/lhome/xen/f12install/vmlinuz"
    ramdisk = "/lhome/xen/f12install/initrd.img"
    ...
    ]

    However,during starting the vm,there are no definitions for kernel and ramdisk in installation file-vm-10.0.0.123.run. Why?Where are kernel and ramdisk?


  • # xm create -c f12.install
    and after finishing the installation.At the last window:
    It shows “Congratlation..”.
    I check [reboot] it.
    But when I try :
    # xm console F12INSTALL

    It loops back to the first window which met during “xm create -c f12.install”.

    • I see. The reboot use the old configuration for this DomU, so it goes back to the installation process.

      Please first shutdown the VM by ‘xm shutdown F12INSTALL’. Then change the configuration for this VM. You can start the VM again and it will boots with the kernel in its /boot (if configure the bootloader as pygrub).

  • 您好,我按照您的方法,在fedora12X86_64上安装了xen4.0。启动xen 4.0 fedora 2.6.32.13后,正常登录,xen测试正常,但是在执行
    # xm create -c f12.install
    initial ….

    initializing cgroup subsys net_cls 此步运行较长时间,宿主机的网络符号一直在运行,过了一会才显示正常。
    但后面就停了,无法进入虚拟机的console

    注:我xen 4.0 fedora宿主机的IP采用DHCP。

    • Please post the network configuration of domain 0 by the ‘ifconfig’ command. We may take a look at it.

      • [czm@cx003 ~]$ ifconfig
        eth0 Link encap:Ethernet HWaddr C8:0A:A9:0F:4E:E9
        inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
        RX packets:8050 errors:0 dropped:0 overruns:0 frame:0
        TX packets:3889 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0
        RX bytes:3292683 (3.1 MiB) TX bytes:410673 (401.0 KiB)

        lo Link encap:Local Loopback
        inet addr:127.0.0.1 Mask:255.0.0.0
        UP LOOPBACK RUNNING MTU:16436 Metric:1
        RX packets:8 errors:0 dropped:0 overruns:0 frame:0
        TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0
        RX bytes:400 (400.0 b) TX bytes:400 (400.0 b)

        peth0 Link encap:Ethernet HWaddr C8:0A:A9:0F:4E:E9
        UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
        RX packets:8059 errors:0 dropped:0 overruns:0 frame:0
        TX packets:3901 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:3414174 (3.2 MiB) TX bytes:413271 (403.5 KiB)
        Interrupt:177

        vif2.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
        UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
        RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:32
        RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

        virbr0 Link encap:Ethernet HWaddr 66:CE:8E:8C:35:86
        inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
        RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0
        RX bytes:0 (0.0 b) TX bytes:4491 (4.3 KiB)

        [czm@cx003 ~]$

        +++++++++++++++++++++++++++++++++++++++++++++++
        vi ifcfg-eth0

        # Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller
        DEVICE=eth0
        HWADDR=c8:0a:a9:0f:4e:e9
        ONBOOT=yes
        BOOTPROTO=dhcp
        TYPE=Ethernet
        NM_CONTROLLED=yes
        USERCTL=yes
        IPV6INIT=no
        PEERROUTES=yes
        NAME=”System eth0″
        UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
        PREFIX=24
        PEERDNS=yes

Add your comments, share your thoughts

Be nice. Keep it clean. Stay on topic. No spam.