How to Install Paravirtualized CentOS 7 DomU on Xen

This post introduces how to install a paravirtualized CentOS 7 DomU on Xen. The very common way of installing DomU does not work for CentOS 7. A little trick to set the repository and the network used by the VM should be used by adding a setting strings to the “extra=” field for this VM.

To install the DomU VM, first download the pxeboot images from CentOS’s official website at http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/.

The commands are (assume we are working in a directory of the VM /home/xen/centos7/ ):

# wget http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz
# wget http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img

Prepare the configuration file centos7.cfg used for the VM:

name="centos7install"
vcpus=4
memory=2048
disk=['file:/home/xen/centos7/vmdisk0,xvda,w' ]
vif=['bridge=xenbr0']
on_reboot="restart"
on_crash="restart"
kernel="/home/xen/centos7/vmlinuz"
ramdisk="/home/xen/centos7/initrd.img"
extra="ksdevice= inst.repo=http://mirror.centos.org/centos/7/os/x86_64/ ip=10.0.0.222::10.0.0.2:255.255.0.0:cento7:eth0:none nameserver=8.8.8.8"

Here, note the trick of adding the line

extra="ksdevice= inst.repo=http://mirror.centos.org/centos/7/os/x86_64/ ip=10.0.0.222::10.0.0.2:255.255.0.0:cento7:eth0:none nameserver=8.8.8.8"

Here 10.0.0.222 is the IP assigned to the VM and 10.0.0.2 is the gateway. You will need to change the parameters here according to your network environment for the VM.

Prepare the disk image for the VM in the VM’s directory:

# dd if=/dev/zero of=./vmdisk0 bs=1k seek=20480k count=1

Now, start the VM and it will starts to install itself,

# xl create -c centos7.cfg

Then, just follow the CentOS 7’s instructions to install and configure the VM.

Booted the kernel and starting to download the installation files:

cenos7-xen-domu-01.png

Choose the installation interface (choose “Use text mode”):

cenos7-xen-domu-03.png

Make the choices for various OS configurations:

cenos7-xen-domu-04.png

Started to install packages:

cenos7-xen-domu-05.png

Installation completes:

cenos7-xen-domu-06.png

Boot the VM again with a normal configuration file and it work nicely now:

cenos7-xen-domu-07.png
Eric is a father and systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *