Fedora 21 on XenServer

In this post:

  1. Prebuilt Fedora Cloud images for XenServer
  2. Kickstart scripts for Fedora Server on XenServer

Fedora
Fedora 21 was just released earlier this week on December 9, 2014. The biggest change was the separation of the distribution into three “products”:

  • Fedora Cloud, a lightweight optimized distribution for public/private clouds, containerization with Docker and Project Atomic.
  • Fedora Server, the traditional platform for running services, usually on a headless host whether virtualized or on baremetal.
  • Fedora Workstation, a developer-friendly desktop running a cutting edge OS.

Of course, as always, OpenStack/KVM and Docker get a lot of love, but Xen and XenServer are once again ignored. This post is my solution. With the prebuilt images distributed here and the kickstart scripts below, you can deploy Fedora 21 on your own XenServer (6.2+).

Prebuilt Fedora Cloud images for XenServer

Update (2017-04-28): Because this release is now out of date and possibly insecure, the .xva images have been deleted.

Since the new Fedora Cloud images are so lightweight, I’ve repackaged them for XenServer with no modification except format conversion. These are the original Fedora Project releases, converted to VHDs and attached to VM templates for XenServer. Xen Tools are not installed! Note also that Fedora Cloud images come with a minimal set of command line tools, so even basic tools like dig may not be available.

After downloading, you must decompress the XZ compression before either

  • importing the .xva into XenCenter (File -> Import), or
  • importing the dom0 command line (e.g. xe vm-import filename=/path/to/fedora-cloud-21-base-20141203-pvhvm.xva)

1. Fedora Cloud Atomic Host (for running Docker containers)

  • Fedora 21 (2014-12-03)
    Filename: fedora-cloud-21-atomic-host-20141203-pvhvm.xva.xz
    Size: 284 MB xz-compressed; 802 MB decompressed
    Specs: 2 vCPUs, 2 GB RAM, 6 GB disk**
    SHA256 hash: e14f503a7fe069e5c3e021aa627309ce29929298c86f60be4ece896fe66eae76
    MD5 hash: 9002869b63ffcdb662c6a8a44d2454bf
    Username: fedora
    Password: *** see below

2. Fedora Cloud General Purpose (for lightweight VMs)

  • Fedora 21 (2014-12-03)
    Filename: fedora-cloud-21-base-20141203-pvhvm.xva.xz
    Size: 125 MB xz-compressed; 438 MB decompressed
    Specs: 1 vCPU, 1 GB RAM, 3 GB disk**
    SHA256 hash: 95d6638faa4d5d36251b0f3a40d02e1629ddd52a996b67590453fef3cd2b635f
    MD5 hash: 63509a1833fbb36781f7b9d5ed92f43e
    Username: fedora
    Password: *** see below

*** How do I log on to this thing? ** And can I change the disk size?

There is no default password because these cloud images were originally built for environments where configuration would be supplied upon boot. To seed the machine with a user password for the default user account, you must provide cloud-init with configuration files. In a non-private-cloud deployment, such as on XenServer, the easiest way to do so is by attaching an ISO containing a meta-data and user-data file. The default disk sizes are small (and should not be expanded) because you can mount additional drives—for instance, you should probably attach a separate XenServer virtual disk and mount it at /var/lib/docker if you plan on using Atomic Host. These can be customized using the user-data file.

Option 1. Example deploy.

Download the init-example.iso file here and attach it to your new Fedora Cloud VM in XenServer. It will initialize your VM with a hostname of cloudhost and a default password of Asdfqwerty. Once you log in for the first time, you should change everything! Be careful! This example also sets an authorized SSH key on the default user, even though it’s an example key.

Option 2. Set your own hostname, username, and SSH keys.

I’ve created a project (shared on GitHub) which will allow you to do this easily. Just clone it, edit the user-data file, and run the ./build.sh script to make your own init.iso. Attach that ISO to your Fedora Cloud VM and it will set all the right details.

You’ll need to create your own configuration if you want to deploy an SSH key,

Roll your own image

For anyone who’s interested… the process for converting Fedora Cloud images to a XenServer format can be replicated as follows:

  1. Download the .raw.xz “General Purpose” or “For Containers” cloud images directly from the Fedora Project.
  2. Decompress the .xz, leaving a .raw hard drive image.
  3. Use VHDTool to convert .raw -> .vhd, which is mostly just adding some metadata.
  4. (optional) Use a tool like VirtualBox to copy the .vhd to a new sparse/dynamically allocated .vhd to reduce file size.
  5. Import the .vhd into XenCenter, and assign vCPUs/RAM/storage. Be aware that this creates a PVHVM guest.
  6. (optional) Convert the resulting VM to a template. Export the template to file, producing the .xva file.
  7. Compress the .xva XenServer image with xz, generating the .xva.xz images above.

Kickstart scripts for installing Fedora Server 21 on XenServer

In past series, I’ve shown you how to launch Fedora 20 as a PV guest, CentOS 7 as a PV guest, CentOS 7 as a PVHVM guest, and Ubuntu 14.04 as a PV guest. After recent benchmarks, however, I’ve decided to move forward with PVHVM exclusively, since the advantages of Xen paravirtualization are no longer necessarily applicable with hardware extensions that PVHVM can take advantage of. The script was tested with PVHVM only, although it was prepared in such a way that the same image should function as a PV guest if you decide to go that route.

The following is a kickstart script you can use to deploy Fedora Server 21. To use it without modification, append

ks=http://cdn.rawgit.com/frederickding/xenserver-kickstart/42ba252be3c89ec0e9cddfc67bf417235987374c/fedora-21/f21-server.ks

to the boot options when booting from the netinstaller ISO, PXE boot, or DVD. The installation will look something like this:

and when it’s done, you’ll be able to log in as the fedora user with the password Asdfqwerty. This user is in the wheel group and can sudo using its own password.

Some caveats: as a consequence of the Fedora 21 separation into products, the Fedora Server product expects NetworkManager and FirewallD. Thus, I no longer attempt to exclude NetworkManager from package selection.

3 Replies to “Fedora 21 on XenServer”

  1. OpenStack and KVM get all the love because those are the groups that contribute to Fedora. If you want to see XenServer support improved, why not join the project? Maybe subscribe to the Fedora Cloud SIG mailing list and help get the work you did here into Fedora proper.

  2. Thanks a ton. This guide (the iso) helped me boot and login to the raw cloud image for f21.

Comments are closed.