How to install FreeBSD 11 on Google Cloud Compute

Posted on in Categories , , last updated January 31, 2017

How can I deploy or install FreeBSD version 11.x Unix operating system on the Google cloud engine? Do I need to create my own FreeBSD disk image to start with the Google Cloud Compute?

It is true that the Google Compute Engine support for Debian, Ubuntu, RHEL, SUSE, and FreeBSD Unix. However, create an instance page only display handful of operating systems as follows:
Fig.01: On VM creation page only Linux and Windows are available
Fig.01: On VM creation page only Linux and Windows are available

You can easily create FreeBSD based VM using the following procedure.

Install gcloud SDK on Linux

First, make sure that Python 2.7 is installed on your Linux based desktop system:
$ wget
$ tar zxvf google-cloud-sdk-141.0.0-linux-x86_64.tar.gz

Initialize the gcloud SDK:
$ gcloud init
In your browser, log in to your Google user account when prompted and click Allow to grant permission to access Google Cloud Platform resources. Verify that it is working:
$ gcloud auth list

Install gcloud SDK on Mac OS X

Type the following commands:
$ wget
$ tar -zxvf google-cloud-sdk-141.0.0-darwin-x86_64.tar.gz
$ ./google-cloud-sdk/
$ gcloud init
$ gcloud auth list

Get list of gcloud compute images

Type the following command:
$ gcloud compute images list --project freebsd-org-cloud-dev --no-standard-images
$ gcloud compute images list \
--project freebsd-org-cloud-dev \
--no-standard-images | grep -i freebsd-11

Sample outputs:

freebsd-11-0-beta4-amd64                  freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-07-23     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-08-04     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-08-19     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-08-27     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-09-04     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-09-18     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-10-02     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-10-09     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-10-17     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-10-24     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-11-03     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-11-10     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-11-20     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-12-01     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-12-18     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2015-12-29     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2016-01-07     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2016-01-13     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2016-01-22     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2016-01-28     freebsd-org-cloud-dev                      READY
freebsd-11-0-current-amd64-2016-02-06     freebsd-org-cloud-dev                      READY
freebsd-11-0-rc1-amd64                    freebsd-org-cloud-dev                      READY
freebsd-11-0-rc2-amd64                    freebsd-org-cloud-dev                      READY
freebsd-11-0-rc3-amd64                    freebsd-org-cloud-dev                      READY
freebsd-11-0-release-amd64                freebsd-org-cloud-dev                      READY
freebsd-11-0-release-p1-amd64             freebsd-org-cloud-dev                      READY
freebsd-11-0-stable-amd64-2016-10-22      freebsd-org-cloud-dev                      READY
freebsd-11-0-stable-amd64-2016-11-01      freebsd-org-cloud-dev                      READY
freebsd-11-0-stable-amd64-2016-12-10      freebsd-org-cloud-dev                      READY
freebsd-11-0-stable-amd64-2016-12-21      freebsd-org-cloud-dev                      READY
freebsd-11-0-stable-amd64-2017-01-06      freebsd-org-cloud-dev                      READY

How to deploying FreeBSD 11 on Google cloud

The syntax is:
$ gcloud compute instances create {INSTANCE} --image freebsd-11-0-release-amd64 \

You need minimum 22GB disk space. So here is my command to create a VM in us-central1-c zone, n1-standard-1 machine type, and boot disk set to 60GB SSD storage:
$ gcloud compute instances create "nixcraft-freebsd11" \
--zone "us-central1-c" \
--machine-type "n1-standard-1" \
--subnet "default" --maintenance-policy "MIGRATE" \
--image "freebsd-11-0-release-p1-amd64" --image-project=freebsd-org-cloud-dev \
--boot-disk-size "60" \
--boot-disk-type "pd-ssd"

Sample outputs:

Fig.02: FreeBSD 11 on Google Compute Engine Deployed
Fig.02: FreeBSD 11 on Google Compute Engine Deployed

How to ssh into FreeBSD 11 Google cloud compute server?

Simply type the following command:
$ gcloud compute ssh {INSTANCE}
$ gcloud compute ssh {INSTANCE} --zone "us-central1-c"
$ gcloud compute ssh nixcraft-freebsd11 \
--zone "us-central1-c" \
--project "mybsdvms-nixcraft-156800"
$ ssh -i ~/.ssh/my-gcs [email protected]

Sample session:

Fig.03: SSH into my Google cloud server powered by FreeBSD 11
Fig.03: SSH into my Google cloud server powered by FreeBSD 11

How do I login as root user?

Simply type the command:
$ sudo -s

How do I install a bash shell?

Simply type the following pkg command to install a bash shell on FreeBSD 11, run:
# pkg install bash
Sample outputs:

Fig.04: Howto Install BASH in FreeBSD using pkg Command
Fig.04: Howto Install BASH in FreeBSD using pkg Command

2 comment

  1. Great tutorial!

    I’ve been running FreeBSD instances on Green for the better part of a year, (10-RELEASE, 11-CURRENT 11-STABLE lately) and the only reference I could find to get FreeBSD images was buried deep in an obscure thread on the FreeBSD forums. This writeup should be somewhere on the handbook. Perhaps a mini-chapter on deploying instances on different public clouds would be greatly beneficial. I’ve also got a couple of 9.x instances on Rackspace. AWS I haven’t tried yet. Or azure.

Leave a Comment