Run FreeBSD / OpenBSD / NetBSD on OpenStack

FreeBSD, OpenBSD, and NetBSD are all free and open-source operating systems build on the Berkeley Software Distribution (BSD) Unix base. They have different target audience, strengths and design focus. See the table below which summarizes the key points when comparing the three.

FeatureFreeBSDOpenBSDNetBSD
FocusFeatures, Stability, PerformanceSecurityPortability
Target AudienceServers, Desktops, Embedded SystemsSecurity-Conscious UsersDiverse Hardware
StrengthsWide Feature Set, Ease of Use, CommunityUnmatched Security, Unique Features, TransparencyRuns on Many Platforms, Clean Code, Developer Friendly
ConsiderationsLess Security Focus Compared to OpenBSDMore Technical Expertise NeededSmaller User Base, Potentially Fewer Software Packages
FreeBSD vs OpenBSD vs NetBSD

In this article we will show you how to run FreeBSD, OpenBSD, NetBSD, and as an extra DragonFlyBSD in your private OpenStack Cloud environment.

Download FreeBSD, OpenBSD and NetBSD Qcow2 images

We will use unofficial OpenStack images for these BSD systems available on BSD-Cloud-Image.org. The images come with Cloud-init, hence can be run on all the main Cloud providers.

Use the link to get the latest Qcow2 images before running the download commands using wget. Remember to replace URLs for the images given with latest from BSD-Cloud-Image website.

Download FreeBSD Cloud images

Choose ZFS or UFS cloud image. UFS should be okay for most use cases.

# FreeBSD 14 - using UFS
wget https://object-storage.public.mtl1.vexxhost.net/swift/v1/1dbafeefbd4f4c80864414a441e72dd2/bsd-cloud-image.org/images/freebsd/14.0/2024-05-04/ufs/freebsd-14.0-ufs-2024-05-04.qcow2

# FreeBSD 14 - using ZFS
wget https://object-storage.public.mtl1.vexxhost.net/swift/v1/1dbafeefbd4f4c80864414a441e72dd2/bsd-cloud-image.org/images/freebsd/14.0/2024-05-06/zfs/freebsd-14.0-zfs-2024-05-06.qcow2

Upload the downloaded FreeBSD cloud image to OpenStack glance.

# FreeBSD - UFS
openstack image create \
    --container-format bare \
    --disk-format qcow2 \
    --file freebsd-14.0-ufs-2024-05-04.qcow2 \
    freebsd-14.0-ufs

# FreeBSD - ZFS
openstack image create \
    --container-format bare \
    --disk-format qcow2 \
    --file freebsd-14.0-zfs-2024-05-04.qcow2 \
    freebsd-14.0-zfs

Download OpenBSD Cloud image

Latest available at the time of writing this post is v7.5.

wget https://github.com/hcartiaux/openbsd-cloud-image/releases/download/v7.5_2024-05-13-15-25/openbsd-min.qcow2

Upload OpenBSD cloud image to OpenStack – Replace 7.5 with your correct version number.

openstack image create \
    --container-format bare \
    --disk-format qcow2 \
    --file openbsd-min.qcow2 \
    openbsd-7.5

Download NetBSD Cloud image

The most current available image version is 9.3. Update accordingly.

wget https://object-storage.public.mtl1.vexxhost.net/swift/v1/1dbafeefbd4f4c80864414a441e72dd2/bsd-cloud-image.org/images/netbsd/9.3/2023-04-23/ufs/netbsd-9.3-2023-04-23.qcow2

Upload NetBSD cloud image to OpenStack:

openstack image create \
    --container-format bare \
    --disk-format qcow2 \
    --file netbsd-9.3-2023-04-23.qcow2 \
    netbsd-9.3

Download DragonFlyBSD Cloud image

Download the latest image available on the provided website link.

wget https://object-storage.public.mtl1.vexxhost.net/swift/v1/1dbafeefbd4f4c80864414a441e72dd2/bsd-cloud-image.org/images/dragonflybsd/6.4.0/2023-04-23/ufs/dragonflybsd-6.4.0-ufs-2023-04-23.qcow2

Upload DragonFlyBSD image to OpenStack

openstack image create \
    --container-format bare \
    --disk-format qcow2 \
    --file dragonflybsd-6.4.0-ufs-2023-04-23.qcow2 \
    dragonflybsd-6.4

Creating FreeBSD, OpenBSD and NetBSD VM Instance on OpenStack

Confirm a list of images in OpenStack cloud.

$ openstack image list
+--------------------------------------+--------------------+--------+
| ID                                   | Name               | Status |
+--------------------------------------+--------------------+--------+
| 738d0c30-77d1-4fe0-80e8-1609faec880f | dragonflybsd-6.4   | active |
| 48f58997-7610-495c-9895-c2ca413161f0 | freebsd-14.0-ufs   | active |
| d1321357-ef3b-4826-9b50-4884a748ab8a | netbsd-9.3         | active |
| 5c395d7c-b8c4-4956-9616-5f835bfd37ef | openbsd-7.5        | active |
+--------------------------------------+--------------------+--------+

Before creating a VM instance from any of the BSD image we have uploaded to OpenStack, we have to get some key information from our cluster.

# List instance flavors
openstack flavor list

# List keypairs
openstack keypair list

# List Networks
openstack network list

# List Security groups
openstack security group list

To create an instance we use the commands below.

openstack server create \
  --flavor <flavor> \
  --network <network> \
  --key-name <keypair> \
  --image <image> \
  --security-group <security_group> \
  <vm_name>

Where:

  • openstack server create: Base command for creating VM instances
  • --flavor <flavor>: Specifies flavor (or instance type) used
  • --network <network>: Specifies network attached to the instance
  • --key-name <keypair>: Specifies SSH key pair to be injected for SSH access. See our guide on how to create SSH keypairs on OpenStack.
  • --image <image>: Specifies OS cloud image used to create an VM instance.
  • --security-group <security_group>: Specifies security group used by. the instance.
  • vm_name: Specifies instance name. Any name that fits your naming conventions.

See examples below on how to create a VM instance with the BSD images we just uploaded. But substitute the values to match your OpenStack cloud environment.

  • Creating FreeBSD instance
openstack server create \
  --flavor linux-basic-vps \
  --network public \
  --key-name jkmutai \
  --security-group allow_all \
  --image freebsd-14.0-ufs \
  freebsd14
  • Creating OpenBSD instance
openstack server create \
  --flavor linux-basic-vps \
  --network public \
  --key-name jkmutai \
  --security-group allow_all \
  --image openbsd-7.5 \
  openbsd7
  • Creating NetBSD instance
openstack server create \
  --flavor linux-basic-vps \
  --network public \
  --key-name jkmutai \
  --security-group allow_all \
  --image netbsd-9.3 \
  netbsd9
  • Creating DragonFlyBSD
openstack server create \
  --flavor linux-basic-vps \
  --network public \
  --key-name jkmutai \
  --security-group allow_all \
  --image dragonflybsd-6.4 \
  dragonflybsd6

List running instances in OpenStack by running the command below.

$ openstack server list
+--------------------------------------+----------------------+--------+-----------------------+------------------+--------------------+
| ID                                   | Name                 | Status | Networks              | Image            | Flavor             |
+--------------------------------------+----------------------+--------+-----------------------+------------------+--------------------+
| 903cd029-aea4-4177-b55b-165a1eeca215 | freebsd14            | ACTIVE | public=192.168.20.233 | freebsd-14.0-ufs | linux-basic-vps    |
| ef9043c6-3457-41a3-9757-eae6f0128b0e | dragonflybsd6        | ACTIVE | public=192.168.20.244 | dragonflybsd-6.4 | linux-basic-vps    |
| 52d88f23-c490-40a0-8e5a-7bba725f0eb3 | netbsd9              | ACTIVE | public=192.168.20.235 | netbsd-9.3       | linux-basic-vps    |
| 43774644-3884-4620-9a73-8530f69d9899 | openbsd7             | ACTIVE | public=192.168.20.237 | openbsd-7.5      | linux-basic-vps    |
+--------------------------------------+----------------------+--------+-----------------------+------------------+--------------------+

How to SSH into the instances

Follow the following steps to SSH into the instances you just created in OpenStack.

Prerequisites

  1. SSH Key Pair: You must have the private SSH key to the used public key in OpenStack (keypair)
  2. Security Group Rules: Assigned security group must allow SSH (port 22) access to the instance.
  3. Floating IP (if required): When using private network on instances deployed in OpenStack, you will need a floating IP to make it possible to SSH from an external network to your. For public network this is not required.
openstack floating ip create public <network>
openstack server add floating ip <server> <floating-ip>

Login username for the instances are:

  • FreeBSD: freebsd
  • OpenBSD: openbsd
  • NetBSD: netbsd

SSH into FreeBSD instance running on OpenStack

$ ssh [email protected]
FreeBSD 14.0-RELEASE (GENERIC) #0 releng/14.0-n265380-f9716eee8ab4: Fri Nov 10 05:57:23 UTC 2023

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List:        https://www.FreeBSD.org/lists/questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

To change this login announcement, see motd(5).
Man pages are divided into section depending on topic.  There are 9 different
sections numbered from 1 (General Commands) to 9 (Kernel Developer's Manual).
You can get an introduction to each topic by typing

        man <number> intro

In other words, to get the intro to general commands, type

        man 1 intro
freebsd@bsdserver01:~ %

We can run commands to check OS release.

freebsd@bsdserver01:~ % cat /etc/os-release
NAME=FreeBSD
VERSION="14.0-RELEASE"
VERSION_ID="14.0"
ID=freebsd
ANSI_COLOR="0;31"
PRETTY_NAME="FreeBSD 14.0-RELEASE"
CPE_NAME="cpe:/o:freebsd:freebsd:14.0"
HOME_URL="https://FreeBSD.org/"
BUG_REPORT_URL="https://bugs.FreeBSD.org/"

To update use the following commands.

freebsd@bsdserver01:~ % sudo pkg update
Updating FreeBSD repository catalogue...
Fetching data.pkg: 100%    7 MiB   7.3MB/s    00:01

Processing entries: 100%
FreeBSD repository update completed. 34082 packages processed.
All repositories are up to date.


freebsd@bsdserver01:~ % sudo pkg upgrade -y
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
New version of pkg detected; it needs to be installed first.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
	pkg: 1.21.2 -> 1.21.3

Number of packages to be upgraded: 1

12 MiB to be downloaded.
[1/1] Fetching pkg-1.21.3.pkg: 100%   12 MiB  12.4MB/s    00:01
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 1.21.2 to 1.21.3...
[1/1] Extracting pkg-1.21.3: 100%
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (2 candidates): 100%
Processing candidates (2 candidates): 100%
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
	glib: 2.80.0,2 -> 2.80.3,2
	py39-requests: 2.31.0 -> 2.32.2

Number of packages to be upgraded: 2

4 MiB to be downloaded.
[1/2] Fetching py39-requests-2.32.2.pkg: 100%   92 KiB  93.8kB/s    00:01
[2/2] Fetching glib-2.80.3,2.pkg: 100%    4 MiB   4.3MB/s    00:01
Checking integrity... done (0 conflicting)
[1/2] Upgrading py39-requests from 2.31.0 to 2.32.2...
[1/2] Extracting py39-requests-2.32.2: 100%
[2/2] Upgrading glib from 2.80.0,2 to 2.80.3,2...
[2/2] Extracting glib-2.80.3,2: 100%
==> Running trigger: gio-modules.ucl
Generating GIO modules cache
==> Running trigger: glib-schemas.ucl
Compiling glib schemas
No schema files found: doing nothing.
freebsd@bsdserver01:~ %

SSH into OpenBSD instance running on OpenStack

Login as openbsd user:

$ ssh [email protected]
OpenBSD 7.5 (GENERIC.MP) #82: Wed Mar 20 15:48:40 MDT 2024

Welcome to OpenBSD: The proactively secure Unix-like operating system.

Please use the sendbug(1) utility to report bugs in the system.
Before reporting a bug, please try to reproduce it with the latest
version of the code.  With bug reports, please try to ensure that
enough information to reproduce the problem is enclosed, and if a
known fix for it exists, include that as well.


This cloud-image has been generated by build_openbsd_qcow2.sh

cf. https://github.com/hcartiaux/openbsd-cloud-image/
This image comes with a minimalist / partition. You can use the
remaining disk space by adjusting /root/bin/create_partitions.sh
to match your expectations and run the script as root.
openbsd7$

SSH into NetBSD instance running on OpenStack

Login as netbsd user:

$ ssh [email protected]
NetBSD 9.3 (GENERIC) #0: Thu Aug  4 15:30:37 UTC 2022

Welcome to NetBSD!

netbsd9$

Conclusion

In this guide we provided the process of downloading pre-packaged FreeBSD, OpenBSD, and NetBSD cloud images for OpenStack. Additionally, we demonstrated how to create an instance and gain access using SSH protocol.

CloudSpinx Expertise (Optional)

Remember you don’t need to worry about performing OpenStack stuff on your own. CloudSpinx offers extensive OpenStack services and our Engineers are available to assist you with everything OpenStack – from installations, configurations, customizations and integrations to the day-to-day administration of your OpenStack private cloud.

To get assistance from the experts, contact CloudSpinx and we will be happy to discuss your specific requirements.

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

Let’s clarify the differences between merge requests (commonly called pull requests in GitHub), releases, release candidates (RCs), tags, and branches […]

Kind (which in full means “Kubernetes IN Docker”), is a command line tool that enables you to run Kubernetes clusters […]

Are you looking for an easy way to migrate packages from one cPanel server to a new cPanel server? In […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.