This guide can be used to install CoreOS on a XenServer VM. We will use PXE to boot a fresh VM, SSH into the box, run the install script, fix an issue with kexec not being available on XenServer, and rebooting into the installed CoreOS machine.
We start with the creation of suitable configuration files for our PXE server. Please refer to the webpage of CoreOS that explains how to accomplish this. Our pxelinux.cfg file looks like this:
LABEL 1 MENU LABEL CoreOS network boot KERNEL coreos/coreos_production_pxe.vmlinuz APPEND initrd=coreos/coreos_production_pxe_image.cpio.gz cloud-config-url=http://www.example.org/coreos/pxe-cloud-config.yml rootfstype=btrfs
Please change the location of the webserver that holds the pxe-cloud-config.yml file. The content of that file looks like this:
#cloud-config coreos: units: - name: etcd.service command: start ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQC2PxAKTLdczK9+RNsGGPsz0eC2pBlydBEcrbI7LSfiN7Bo5hQQVjki+Xpnp8EEYKpzu6eakL8MJj3E28wT/vNklT1KyMZrXnVhtsmOtBKKG/++odpaavdW2/AU0l7RZiE=
Be sure to change the public key in this file to your own.
Now create a XenServer VM and let it boot from network (i.e. PXE): select “Other install media” and choose the option “Boot from network”. Now start the VM and let it boot up. When it is finished, the VM will print its hostname, IP address and SSH keys signatures. Use SSH to connect to the machine with user ‘core’. If you loaded your private key that corresponds with the public key that you set up in the cloud-config file, you should be allowed to log in.
Now we can move on to install CoreOS onto the disk. Create a file called /home/core/cloud-config.yml:
#cloud-config ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQC2PxAKTLdczK9+RNsGGPsz0eC2pBlydBEcrbI7LSfiN7Bo5hQQVjki+Xpnp8EEYKpzu6eakL8MJj3E28wT/vNklT1KyMZrXnVhtsmOtBKKG/++odpaavdW2/AU0l7RZiE=
Again, be sure to replace the public key with your own. Instruct the installation script of CoreOS to use your file and use the harddisk of the VM:
sudo coreos-install -d /dev/xvda -c /home/core/cloud-config.yml
When this is finished, you need to tell CoreOS to stop using kexec because this does not work with XenServer:
sudo -s mount LABEL=EFI-SYSTEM /mnt echo "DEFAULT coreos.A" > /mnt/syslinux/default.cfg umount /mnt
Now reboot the VM. Make sure that it does not use PXE, but boots from the harddisk.