* Note: This post is divided into two parts. The former part is:
Step 2: Convert VDI image to RAW image for GCE and compress it to upload
We have created a virtual machine image where OpenBSD is installed.
Next step is to convert it to a compressed raw image as to upload to Google Cloud Storage.
$ cd "~/VirtualBox VMs/openbsd-64-amd64/" # where you created the image
$ # convert image
$ VBoxManage internalcommands converttoraw openbsd-64-amd64.vdi disk.raw
$ # compress it
$ tar -Szcf openbsd-64-amd64.tar.gz disk.raw
$ rm disk.raw # if necessary
Step 3: Upload the image to Google Cloud Storage
Is it prepared, a bucket of Google Cloud Storage?
If not, access Dashboard and execute "CREATE BUCKET".
Let's go to the steps to manage Google Cloud.
gsutil
commands are available:
First, upload the file:
$ gsutil cp -a public-read openbsd-64-amd64.tar.gz gs://[your-bucket]/openbsd-64-amd64.tar.gz
Copying file://openbsd-64-amd64.tar.gz [Content-Type=application/x-tar]...
| [1 files][370.1 MiB/370.1 MiB] 986.6 KiB/s
Operation completed over 1 objects/370.1 MiB.
* Note: When finishing uploading, you can delete the local file if necessary:
$ rm openbsd-64-amd64.tar.gz
Next, create image from the uploaded file.
* Note: When you are in a retry action, you might have to delete the previous image:
$ gcloud compute --project [your-project] --quiet images delete openbsd-64-amd64
Deleted [https://www.googleapis.com/compute/v1/projects/[your-project]/global/images/openbsd-63-amd64].
Create image:
$ gcloud compute --project [your-project] images create openbsd-64-amd64 --source-uri gs://[your-bucket]/openbsd-64-amd64.tar.gz
Created [https://www.googleapis.com/compute/v1/projects/[your-project]/global/images/openbsd-64-amd64].
NAME PROJECT FAMILY DEPRECATED STATUS
openbsd-64-amd64 [your-project] READY
Delete a used resource file in the bucket as needed:
$ gsutil rm gs://[your-bucket]/openbsd-64-amd64.tar.gz
Step 4: Create an instance on GCE
First of all, to sign in Google Cloud Console is required.
And then, choose menus: [Compute Engine] - [VM instances]:
OK. Let's start creating an instance:
Set "Boot Disk" with uploaded OpenBSD virtual image:
* Note: Your image is found at the "Custom Images" list:
Execute creation:
Now it's done!
Usage
We can access our virtual machine via ssh
commands like these: ssh user@host
or ssh host -l user
.
I hope to type ssh
brings happiness to you, too : )
You will see the message "Welcome to OpenBSD":
After running an instance, we can build various servers like these:
Option: A small unsolved question left to me
I seem to have been able to manage OpenBSD vm on GCE by "Connect to serial console" after "Enable connecting to serial ports".
But the response stops at this line...
Do I have a wrong memory?
If you have some knowledge or solution, I'll be glad to hear from you : )
Outro
After all, I made my understanding deeper about not only creating an OpenBSD image but also creating custom images for cloud computing.
It was a very good experience to me.
Well, we sometimes need to patch the system or update the packages for the sake of security or/and improvement.
So I'm planning to write about post-installation settings of OpenBSD.
Happy serving 🕊