Differences

This shows you the differences between two versions of the page.


centos_xen [2016/04/25 22:38] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== CentOS Xen ======
  
 +  * [[CentOS]]
 +  * [[Xen]]
 +
 +==== Installer ISO as Domain Guest ====
 +
 +Installing any OS as a Xen guest booting an ISO can be a bit of a pain. There's a couple of steps involved, but it is possible, and it doesn't require munging or rebuilding ISOs.
 +
 +Normally, when a Xen guest boots up, it will either use a GRUB emulator (pygrub, pvgrub, pvgrub2) or a kernel and initrd on the Xen domain filesystem directly. Since the ISO is booting using ISOLINUX, that means there needs to be an alternate option.
 +
 +Here, we extract the kernel and initrd from the ISO, and use those to start the Xen guest, and then continue going through the ISO install as normal.
 +
 +First, mount the ISO:
 +
 +<code>
 +mkdir /tmp/centos-iso-contents
 +mount -o mount,ro centos.iso /tmp/centos-iso-contents
 +</code>
 +
 +Get the kernel files needed:
 +
 +<code>
 +cp /tmp/centos-iso-contents/isolinux/initrd.img /etc/xen/kernels/centos.initrd.img
 +cp /tmp/centos-iso-contents/isolinux/vmlinuz /etc/xen/kernels/centos.vmlinuz
 +</code>
 +
 +You won't need anything else from the ISO, so you can unmount it if desired:
 +
 +<code>
 +umount /tmp/centos-iso-contents
 +</code>
 +
 +Create a Xen config file for the new guest. Located here in ''/etc/xen/configs''. Here are the important settings, for booting the ISO for the first time:
 +
 +<code>
 +kernel = "/etc/xen/kernels/centos-6.6/vmlinuz"
 +ramdisk = "/etc/xen/kernels/centos-6.6/initrd.img"
 +disk = [ 'file:/etc/xen/isos/centos.iso,hdc:cdrom,r' ]
 +boot = 'c'
 +</code>
 +
 +Those are the bare basics. It doesn't include an entry for a place to install the OS. So, this assumes you understand Xen enough to know you need an additional disk. Here would be an example where you have a partition set apart for the install, with ''/dev/sda4'' as the original device, and displaying it as ''/dev/xvda'' to the Xen guest:
 +
 +<code>
 +disk = [ 'file:/tmp/boot.iso,hdc:cdrom,r','phy:/dev/sda4,xvda,rw' ]
 +</code>
 +
 +That right there is enough to add into your Xen guest config file to get you booted into your ISO. Once you're finished, remove the ''kernel'', ''ramdisk'', ''boot'' entries, and the ISO from the ''disk'' entry in your Xen config file.
 +
 +Then boot as normal:
 +
 +<code>
 +bootloader = "pygrub"
 +</code>
 +
 +That's it!
 +
 +=== Using a Kickstarter File ===
 +
 +You can use a [[CentOS Kickstart|kickstarter file]] if you'd like. In the simplest case, you'd normally rebuild an ISO with the ''ks.cfg'' file in the ''/'' directory on the filesystem. That won't work here because we're booting from a kernel outside of that filesystem. You can still tell Xen to use the ''ks.cfg'' file though, by passing it as a string to the kernel boot parameters:
 +
 +<code>
 +extra = "ks=cdrom:/ks.cfg"
 +</code>

Navigation
QR Code
QR Code centos_xen (generated for current page)