Running Fedora 21 on Google Compute Engine


In my current role at Rancher Labs, we do a lot of testing and provisioning on Google Compute Engine. One of the things that we found missing were official Ubuntu and Fedora images. Fortunately, Ubuntu now has official images on GCE and we hope that Fedora follows as well. There is an open issue to track the official progress, but in the meantime the new Fedora 21 cloud image is straight forward enough to get going. To build your own (unofficial) Fedora 21 image on GCE follow this process. Pre-requisites:

  • gcloud tools installed (Guide)
  • (This should provide the gsutil tool as well.)

Download the raw xz image from the Fedora Project through your browser or curl…

curl -O -X GET -L http://download.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/Images/x86_64/Fedora-Cloud-Base-20141203-21.x86_64.raw.xz

Then from the command line

# Decompress the xz file to disk.raw Google looks for this file.
xz -dc Fedora-Cloud-Base-20141203-21.x86_64.raw.xz > disk.raw

# Create a tar gzip file with the disk.raw file in it.
# From OS X you need to use gtar from the coreutils homebrew package,
# otherwise image creation will fail.
tar -zcf fedora-cloud-base-20141203-21.tar.gz disk.raw

# put it in your bucket
gsutil cp fedora-cloud-base-20141203-21.tar.gz gs:///

# Now create the image
gcloud compute images create  --source-uri  gs:///fedora-cloud-base-20141203-21.tar.gz

Then provision as you normally would. Providing no metadata at create time, the server will get all sshkeys for your GCE project and add them to the fedora user authorized keys. This version of Fedora has cloud-init 0.7.5 with GCE support built in, so you can provide user-data to provision/bootstrap the server with additional users/configuration. Additional things you will want to address…

  • Increasing disk size, the base image ends up with a 3GB disk.
  • Installing the Google Compute tools.

- Bill Maxwell (@cloudnautique) Additional resources:

快速开启您的Rancher之旅