{"id":2433,"date":"2018-03-26T22:03:09","date_gmt":"2018-03-26T20:03:09","guid":{"rendered":"http:\/\/possiblelossofprecision.net\/?p=2433"},"modified":"2021-05-15T11:46:36","modified_gmt":"2021-05-15T09:46:36","slug":"running-fedora-27-on-google-compute-engine","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=2433","title":{"rendered":"Running Fedora 27 on Google Compute Engine"},"content":{"rendered":"<p>Usually Linux distributions with a long life cycle like <a href=\"https:\/\/en.wikipedia.org\/wiki\/Red_Hat_Enterprise_Linux\">RHEL<\/a> (or its free derivative <a href=\"https:\/\/en.wikipedia.org\/wiki\/CentOS\">CentOS<\/a>), <a href=\"https:\/\/en.wikipedia.org\/wiki\/Debian\">Debian<\/a> or <a href=\"https:\/\/en.wikipedia.org\/wiki\/SUSE_Linux_Enterprise\">SLES<\/a> are the way to go for virtual machines in a cloud environment. But sometimes you need to be a little bit closer to upstream. Maybe because your applications relies on newer version of some packages that are not (easily) available on distributions with long term support or maybe because you need a feature that has just not yet made it to RHEL, Debian or SLES.<br \/>\nIn those cases, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Fedora_(operating_system)\">Fedora<\/a> is an interesting choice, since it&#8217;s probably the Linux distribution that&#8217;s closest to upstream and provides the most features that could be considered &#8216;bleeding edge&#8217;. Unfortunately there&#8217;s currently no publicly available Fedora image on the Google Cloud Platform. But not to worry, it&#8217;s quite easy to run Fedora 27 on GCE.<\/p>\n<p>The <a href=\"https:\/\/en.wikipedia.org\/wiki\/Fedora_Project\">Fedora Project<\/a> provides a compressed raw disk image that can be used to spawn VMs on different platforms, e.g. GCE. To use it with the Google Compute Engine, the image has to be renamed and repackaged though:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nwget https:\/\/dl.fedoraproject.org\/pub\/fedora\/linux\/releases\/27\/CloudImages\/x86_64\/images\/Fedora-Cloud-Base-27-1.6.x86_64.raw.xz\r\nxz --decompress Fedora-Cloud-Base-27-1.6.x86_64.raw.xz\r\nmv Fedora-Cloud-Base-27-1.6.x86_64.raw disk.raw\r\ntar cfz Fedora-Cloud-Base-27-1.6.x86_64.tar.gz disk.raw --sparse\r\nrm disk.raw\r\n<\/pre>\n<p>The image can now be uploaded into a Google Cloud Storage bucket:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ngsutil mb gs:\/\/fedora-cloud-base-27\r\ngsutil cp Fedora-Cloud-Base-27-1.6.x86_64.tar.gz gs:\/\/fedora-cloud-base-27\/\r\n<\/pre>\n<p>Now, we can create an image and use that to spawn a GCE instance:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ngcloud compute images create --source-uri gs:\/\/fedora-cloud-base-27\/Fedora-Cloud-Base-27-1.6.x86_64.tar.gz fedora-cloud-base-27\r\ngcloud compute instances create fedora27 --machine-type f1-micro --image fedora-cloud-base-27 --zone us-east1-b\r\n<\/pre>\n<p>Of course, you might want to choose a different machine-type or zone here.<\/p>\n<p>Once the VM is booted (and assuming a metadata key value pair for the project provides a public ssh key) one can connect to the instance via:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ngcloud compute ssh fedora@fedora27\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Usually Linux distributions with a long life cycle like RHEL (or its free derivative CentOS), Debian or SLES are the way to go for virtual machines in a cloud environment. But sometimes you need to be a little bit closer to upstream. Maybe because your applications relies on newer version of some packages that are not (easily) available on distributions&#8230; <a href=\"https:\/\/possiblelossofprecision.net\/?p=2433\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7,81],"class_list":["post-2433","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-fedora","tag-gcp"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/2433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2433"}],"version-history":[{"count":1,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/2433\/revisions"}],"predecessor-version":[{"id":2434,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/2433\/revisions\/2434"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}