warning: this guide is for legacy RHEL, see here for running an up-to-date RHEL guest
RHEL5,6,7 kernels are PV-capable (not PVH), so we’re good already.
mkdir -p /data/kernels/centos/ cd /data/kernels/centos/ wget https://mirror.yandex.ru/centos/7/os/x86_64/images/pxeboot/vmlinuz wget https://mirror.yandex.ru/centos/7/os/x86_64/images/pxeboot/initrd.img # MD5 for v7 # bfabcfc71b255f82633a516e2f9bc441 initrd.img # ee1ce5fdeac00b192df50a9bb89904fc vmlinuz # MD5 for v6 # 00558f12fc3607d12ea7bfb8ef10e2d7 initrd.img # 498f960dcd531dcb7e34144451a30cc6 vmlinuz
as for RHEL5 you would need to grab it from some archive.
#wget http://vault.centos.org/5.11/os/x86_64/images/xen/vmlinuz #wget http://vault.centos.org/5.11/os/x86_64/images/xen/initrd.img
mkdir -p /root/guests/centos/ cd /root/guests/centos/ dd if=/dev/zero of=centos.disk bs=1GB count=0 seek=10
Booting RHEL5,6,7 installers (XEN/PV not PVH)
vi centos kernel = "/data/kernels/centos/vmlinuz" ramdisk = "/data/kernels/centos/initrd.img" name = "centos" vcpus = 3 maxvcpus = 8 memory = 7168 disk = ['file:/root/guests/centos/centos.disk,xvda,w'] vif = [ 'bridge=br0, vifname=centos.0' ]
when it asks for a mirror e.g. for RHEL6
--> http://mirror.centos.org/centos-6/6/os/x86_64/
once finished, you’re ready to grab the kernel and ramdisk from the first partition of the vdisk (/boot/
) e.g. for RHEL6
losetup --find --partscan --show centos6.disk ls -lF /dev/loop0* mkdir lala/ mount /dev/loop0p1 lala/ cp lala/vmlinuz-2.6.32-754.el6.x86_64 /data/kernels/centos6/ cp lala/initramfs-2.6.32-754.el6.x86_64.img /data/kernels/centos6/ cp lala/grub/menu.lst /data/kernels/centos6/ umount lala/ rmdir lala/ losetup -d /dev/loop0
and finish-up as such e.g. for RHEL6
kernel = "/data/kernels/centos6/vmlinuz-2.6.32-754.el6.x86_64" ramdisk = "/data/kernels/centos6/initramfs-2.6.32-754.el6.x86_64.img" root = "/dev/mapper/VolGroup-lv_root ro rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD console=hvc0 KEYTABLE=us rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root rd_NO_DM rhgb quiet"
Some additional Anaconda installer (no kickstart here) settings that might help you speed-up the process e.g. for RHEL7
extra="console=hvc0 net.ifnames=0 biosdevname=0 mitigations=off ifname=eth0 bootdev=eth0 inst.repo=https://mirror.yandex.ru/centos/7/os/x86_64/ inst.kdump_addon=off noipv6 selinux=0 inst.text dhcp"
xl create centos -c
navigate through the virtual windows
ESC TAB
this takes a while
Performing post-installation setup tasks
English HTTP IPv4 DHCP web site http://vault.centos.org directory 5.11/os/x86_64/ text mode initialize disk: yes default partitioning layout ... package selection: uncheck everything reboot
once rebooting
xl console $guest ^] reset xl des $guest losetup --find --partscan --show $guest.disk ll /dev/loop0* mkdir lala mount /dev/loop1p1 lala cat lala/grub/menu.lst cp lala/vmlinuz-3.10.0-1062.el7.x86_64 /data/kernels/centos7/ cp lala/initramfs-3.10.0-1062.el7.x86_64.img /data/kernels/centos7/ ln -sf vmlinuz-3.10.0-1062.el7.x86_64 /data/kernels/centos7/vmlinuz ln -sf initramfs-3.10.0-1062.el7.x86_64.img /data/kernels/centos7/initramfs #cp lala/vmlinuz-2.6.18-398.el5xen /data/kernels/centos5/ #cp lala/initrd-2.6.18-398.el5xen.img /data/kernels/centos5/ #ln -s #ln -s umount lala losetup -d /dev/loop1 losetup -a vi $guest
RHEL7 (w/o the .img
)
ramdisk = "/data/kernels/centos7/initramfs" root = "/dev/xvda3" #extra = "console=hvc0"
RHEL5 (ramdisk according to the symlink w/o the ending .img
)
ramdisk = "/data/kernels/centos5/initrd" root = "/dev/VolGroup00/LogVol00" #root = "/dev/xvda1 ro" extra = "console=xvc0" #extra = "init=/bin/bash"
There is also the pvgrub alternative.
xl create $guest -c
once installation is finished it will reboot. you need to kill that guest and disable install params you defined
^] xl des centos7 vi centos7 #ramdisk="..." #extra="..." xl create centos7 -c
setup a few things for your template e.g.
systemctl stop firewalld systemctl disable firewalld getenforce systemctl stop polkit systemctl disable polkit yum update yum install net-tools yum install wget wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -ivh epel-release-latest-7.noarch.rpm cat >> /etc/hosts <<EOF $ip $host $gw gw EOF echo linstor3 > /etc/hostname echo GATEWAY=$gw > /etc/sysconfig/network ln -s /etc/sysconfig/network-scripts/ifcfg-eth0 /root/ifcfg-eth0 vi ifcfg-eth0 NAME=eth0 DEVICE=eth0 IPADDR=x.x.x.x PREFIX=24 ONBOOT=yes
and proceed with RHEL7 post-installation
xvda vs xvda1 issue
| Traceback (most recent call first): ^ | | File # | | "/tmp/treedir.6201/instimage/usr/lib/anaco : | | nda/partitions.py", line 1007, in : | | hasGptLabel : | | disk = diskset.disks[device] : | | File : | | "/tmp/treedir.6201/instimage/usr/lib/anaco : | | nda/partitions.py", line 1081, in : | | sanityCheckAllRequests : | | elif self.hasGptLabel(diskset, dev): : | | File "/usr/lib/anaconda/autopart.py", v |
Seen with RHEL6 and RHEL7
xc_dom_guest_type: image not capable of booting inside a HVM container: Invalid kernel
–or–
xc: error: panic: xc_dom_elfloader.c:64: xc_dom_guest_type: image not capable of booting inside a HVM container: Invalid kernel
==> You are trying to launch the guest as PVH. Try as PV instead.
Creating and installing a CentOS 5 domU instance https://wiki.centos.org/HowTos/Xen/InstallingCentOSDomU
Building a Xen Guest Root Filesystem using yum and rpm https://www.virtuatopia.com/index.php/Building_a_Xen_Guest_Root_Filesystem_using_yum_and_rpm
Chapter 32. Xen configuration files https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/virtualization/chap-virtualization-xen_configuration_files
Installing in Text Mode https://docs.centos.org/en-US/centos/install-guide/Text_Installation_Intro-x86/
Booting the Installation on 64-bit AMD, Intel, and ARM systems https://docs.centos.org/en-US/centos/install-guide/Boot_x86/#chap-booting-installer-x86
Kickstart Installations https://docs.centos.org/en-US/centos/install-guide/Kickstart2/
How to Install Paravirtualized CentOS 7 DomU on Xen https://www.systutorials.com/239895/install-paravirtualized-centos-7-domu-xen/
Anaconda Boot Options https://rhinstaller.github.io/anaconda/boot-options.html
Chapter 22. Boot Options https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/chap-anaconda-boot-options
CentOS 7 Xen PV guests failing to boot with kernel 3.10.0-693.17.1.el7 https://kevandrews.uk/centos-7-xen-pv-guests-failing-boot-kernel-3100-693171el7
Problems with Centos 7 new kernel and XEN VM (Solved) https://www.centos.org/forums/viewtopic.php?t=64859