CentOS 7
Ads

Xen : Create Virtual Machine
2016/01/25
 
Install GuestOS and create a Virtual Machine. This example shows to install CentOS 7.
[1] This example shows to use Libvirt, so install it first.
# enable CentOS Xen

[root@dlp ~]#
yum --enablerepo=centos-virt-xen -y install libvirt libvirt-daemon-xen virt-install
[root@dlp ~]#
systemctl start libvirtd

[root@dlp ~]#
systemctl enable libvirtd

[2] Create a Virtual Machine with Para-Virtualization.
# create a directory for images

[root@dlp ~]#
mkdir -p /var/xen/images
[root@dlp ~]#
virt-install \
--connect xen:/// \
--paravirt \
--name centos7 \
--ram 4096 \
--disk path=/var/xen/images/centos7.img,size=20 \
--vcpus 2 \
--os-type linux \
--os-variant rhel7 \
--network bridge=br0 \
--graphics none \
--location 'http://ftp.iij.ad.jp/pub/linux/centos/7/os/x86_64/' \
--extra-args 'text console=com1 utf8 console=hvc0'
Starting install...    
# installation starts
[3] After finishing installation, login prompt of GuestOS is show like follows.
CentOS Linux 7 (Core)
Kernel 3.10.0-327.el7.x86_64 on an x86_64

localhost login:
[4] It's possible to switch GurstOS - HostOS with virsh command like the examples on KVM, and also it's possible to do with Xen admin tool like follows.
[root@localhost ~]#    
# Ctrl + ] key

[root@dlp ~]#    
# Host's console
# display active domains

[root@dlp ~]#
xl list

Name            ID   Mem VCPUs      State   Time(s)
Domain-0         0  4090     6     r-----     226.3
centos7          2  4096     2     -b----      17.0

[root@dlp ~]#
xl console centos7
   
# move to Guest
[root@localhost ~]#    
# Guest's console
 
Tweet