TL;DR: a working template is available here if you want.
Let's create a new VM. Use the "CentOS 7" template (you can use the "Other install media" if you don't have this template). Put a CentOS ISO, netinstall is a good option.
CPU, RAM could be changed later, so no worries with that now. Just click on Create VM.
To allow future disk growing, you need to create only one partition on the 10 GiB disk:
Choose your mirror:
Configure your root password. It could be a weak password because we'll deactivate it later.
Now your VM installed, let's configure it:
- just verify your boot order: Hard-drive first! (faster to boot)
- you can let DVD or Network after, in case you'll have problem with your OS. Or you can de-activate them if you don't care with your future template.
Before setting CloudInit, you can install XenServer Xen Tools: this way, they will be shipped with your template.
Insert the "xs-tools.iso", mount it, and install them with
Now the system is install, let's go inside the console, login as root and install Cloudinit!
But first, we'll update our system:
$ yum update
$ yum install cloud-init cloud-utils-growpart ... Total download size: 6.7 M Installed size: 20 M Is this ok [y/d/N]: Y ... Complete!
Growpart package will allow to extend your template if necessary.
The main configuration file for CloudInit is inside
/etc/cloud/cloud.cfg. Almost all default parameters are OK, just modify this one:
It's indicating that existing ssh keys should be deleted on a per-instance basis. On a public image, this should absolutely be set to 'True' (or 1 here).
By the way, the CentOS shipped config will have:
- a default user "centos", with
sudowithout password. Makes sense for a cloud image (it replaces the root user).
- growpart working (extend the FS if the disk is larger than the current partition)
- disabled SSH password authentication (only SSH keys)
- root disabled
- and a lot of other things, you can find documentation here
Let's remove any possible root access:
$ passwd -l root
You're good! You can halt the VM. You won't be able to login anymore with this one, except by using CloudInit from now.
The easiest part, on the halted VM view:
Now, if you go inside the VM creation page:
Then, activate the config drive and put your SSH key:
Want the new VM bigger than the existing template? No problem, edit the root disk size (template disk was 10 GiB originally):
Now start the VM and SSH on its IP, it just works!
Download the template
This template (with Xen Tools) is available here:
- Download link
- MD5 sum: bd9ea10c7896d5fefc2fb7944d6965fe
And import it:
It will appears in the template list!
More templates will come (Ubuntu, Debian). If you want templates for other distros, just tell us in the comment section :)