I ever introduced Installing Xen on Fedora as Domain-0 (Fedora 17) as the first try to use the xen package delivered from Fedora and get away from manually compiling Xen and patching the kernel. In this post, I introduce installing Xen Dom0 on Fedora 20.
First, install the xen pacakges:
# yum install xen
The Linux kernel is already ready to run in Domain-0 with the pv_ops technology enabled.
Run this command to make config for grub2 again:
# grub2-mkconfig -o /boot/grub2/grub.cfg
Otherwise, the kernel may fail to boot.
Then, we can boot the Fedora to run on Xen as Domain-0 by selecting the Fedora, with Xen hypervisor in Grub2 during booting the system. We can also Setting Default Entry in Grub2 and Grub.
After booting Linux on Xen as Domain-0, we can list the information by ‘xl info’ as follow to verify that Xen works.
# xl info host : localhost release : 3.15.6-200.fc20.x86_64 version : #1 SMP Fri Jul 18 02:36:27 UTC 2014 machine : x86_64 nr_cpus : 4 max_cpu_id : 3 nr_nodes : 1 cores_per_socket : 2 threads_per_core : 2 cpu_mhz : 3392 hw_caps : bfebfbff:2c100800:00000000:00007f00:77dafbbf:00000000:00000021:000027ab virt_caps : total_memory : 8064 free_memory : 128 sharing_freed_memory : 0 sharing_used_memory : 0 outstanding_claims : 0 free_cpus : 0 xen_major : 4 xen_minor : 3 xen_extra : .2 xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p xen_scheduler : credit xen_pagesize : 4096 platform_params : virt_start=0xffff800000000000 xen_changeset : xen_commandline : placeholder cc_compiler : gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7) cc_compile_by : mockbuild cc_compile_domain : [unknown] cc_compile_date : Fri Jun 20 21:32:24 UTC 2014 xend_config_format : 4
Configuring the network
Here, we use bridged network.
NetworkManager does not work with bridge currently. To use bridge-based network for Xen. We should change the network management service from NetworkManager to network. The networking configuration is stored in ‘/etc/sysconfig/network-scripts/’.
First, disable NetworkManager and start network:
# systemctl disable NetworkManager.service && systemctl restart network.service
Make sure that the network service is automatically started by:
# chkconfig network on
Then, we can create the configuration file for the bridge. Let’s call the bridge ‘xenbr0’.
Edit ‘/etc/sysconfig/network-scripts/ifcfg-xenbr0’ (we assume dhcp here. You can also give the bridge a static IP as for the other network devices.):
DEVICE=xenbr0 TYPE=Bridge ONBOOT=yes DELAY=0 NM_CONTROLLED=no BOOTPROTO=dhcp
Then find the configuration file for your existing network adapter (e.g. ifcfg-p2p1) and add this line.
Also make sure that
Finally, make the network configuration take effect by:
# systemctl restart network.service
One example Dom-U configuration file
I give one example Domain-U configuration file here as follows.
name="10.8.1.210" vcpus=2 memory=2048 disk=['phy:/dev/vg_xen/vm-10.8.1.210,xvda,w'] vif=['bridge=xenbr0'] bootloader="/usr/bin/pygrub" on_reboot="restart" on_crash="restart" # extra="single"
Most of the old ‘xm’ commands for Domain-U management work under ‘xl’ by just simply replacing ‘xm’ with ‘xl’.