Openstack

Run FreeBSD on OpenStack

FreeBSD is a production-grade Unix operating system known for its network stack, ZFS filesystem, and jails-based isolation. Running FreeBSD as an OpenStack guest gives you a BSD-based workload platform alongside your Linux instances – useful for network appliances, storage nodes, or any workload that benefits from FreeBSD’s strengths. The FreeBSD project publishes official cloud-init enabled QCOW2 images ready for OpenStack deployment.

Original content from computingforgeeks.com - post 33072

This guide walks through deploying FreeBSD 14.4 on OpenStack – from downloading the official cloud image to launching a fully configured instance. We cover image upload, flavor creation, security groups, SSH access, post-boot configuration, filesystem expansion, and snapshotting the instance as a reusable template.

Prerequisites

Before starting, make sure you have the following in place:

  • A working OpenStack environment (DevStack, Packstack, or production deployment)
  • The OpenStack CLI client installed and configured with valid credentials (source your RC file)
  • An SSH key pair added to OpenStack for instance access
  • A network and router configured in your OpenStack project
  • Sufficient quota for at least 1 vCPU, 2 GB RAM, and 20 GB disk

If you need to set up SSH keys in OpenStack, see our guide on adding SSH key pairs to OpenStack using CLI.

Step 1: Download the FreeBSD Cloud Image

FreeBSD publishes official cloud-init enabled QCOW2 images for each release. These images come pre-configured with cloud-init support, so OpenStack can inject SSH keys and network configuration at boot time. Download the FreeBSD 14.4 cloud image with UFS filesystem:

wget https://download.freebsd.org/releases/VM-IMAGES/14.4-RELEASE/amd64/Latest/FreeBSD-14.4-RELEASE-amd64-BASIC-CLOUDINIT-ufs.qcow2.xz

Extract the compressed image once the download finishes:

xz -d FreeBSD-14.4-RELEASE-amd64-BASIC-CLOUDINIT-ufs.qcow2.xz

After extraction, you should have a QCOW2 file ready for upload. Verify it exists:

ls -lh FreeBSD-14.4-RELEASE-amd64-BASIC-CLOUDINIT-ufs.qcow2

The extracted image is roughly 5-6 GB in size. If you prefer ZFS as the root filesystem, download the ZFS variant instead – replace ufs with zfs in the filename.

Step 2: Upload the FreeBSD Image to Glance

Upload the QCOW2 image to OpenStack’s image service (Glance). This makes it available for launching instances across your OpenStack Glance catalog:

openstack image create \
  --disk-format qcow2 \
  --container-format bare \
  --public \
  --file FreeBSD-14.4-RELEASE-amd64-BASIC-CLOUDINIT-ufs.qcow2 \
  FreeBSD-14.4

The upload takes a few minutes depending on your connection speed. Once complete, verify the image is active:

openstack image list --name FreeBSD-14.4

You should see the image listed with status active:

+--------------------------------------+-------------+--------+
| ID                                   | Name        | Status |
+--------------------------------------+-------------+--------+
| a1b2c3d4-e5f6-7890-abcd-ef1234567890 | FreeBSD-14.4| active |
+--------------------------------------+-------------+--------+

Use the --private flag instead of --public if you want the image visible only to your project.

Step 3: Create a Flavor for FreeBSD

Create a dedicated flavor sized for FreeBSD. A minimum of 1 vCPU, 2 GB RAM, and 20 GB disk works for basic usage. For production workloads, increase these values:

openstack flavor create \
  --vcpus 1 \
  --ram 2048 \
  --disk 20 \
  freebsd.small

Confirm the flavor was created:

openstack flavor list

The output should include your new freebsd.small flavor with the correct resource allocation:

+----+---------------+------+------+-----------+-------+-----------+
| ID | Name          |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+---------------+------+------+-----------+-------+-----------+
| .. | freebsd.small | 2048 |   20 |         0 |     1 | True      |
+----+---------------+------+------+-----------+-------+-----------+

Skip this step if you already have a suitable flavor in your environment. Check existing flavors with openstack flavor list first.

Step 4: Configure Security Group Rules

Open SSH (TCP port 22) and ICMP in your security group so you can connect to the FreeBSD instance and test network reachability. If you are using the default security group:

openstack security group rule create \
  --protocol tcp \
  --dst-port 22 \
  --remote-ip 0.0.0.0/0 \
  default

Allow ICMP (ping) traffic for basic connectivity testing:

openstack security group rule create \
  --protocol icmp \
  --remote-ip 0.0.0.0/0 \
  default

Verify the rules are in place:

openstack security group rule list default

You should see rules for TCP port 22 (ingress) and ICMP (ingress) listed. For production, restrict the --remote-ip to your management network CIDR instead of 0.0.0.0/0.

Step 5: Launch the FreeBSD Instance on OpenStack

Launch a new instance using the FreeBSD image, your flavor, security group, key pair, and network. Replace the key and network names with your own:

openstack server create \
  --image FreeBSD-14.4 \
  --flavor freebsd.small \
  --security-group default \
  --key-name mykey \
  --network private-net \
  freebsd-server

Wait for the instance to reach ACTIVE status. Check the build progress:

openstack server show freebsd-server -c status -c addresses

Once the status shows ACTIVE, note the IP address from the addresses field. If your setup requires a floating IP for external access, allocate and assign one:

openstack floating ip create external-net

Assign the floating IP to the instance:

openstack server add floating ip freebsd-server 10.0.1.50

Replace 10.0.1.50 with the actual floating IP allocated in the previous step.

Step 6: Connect to FreeBSD via SSH

The FreeBSD cloud image uses freebsd as the default login user. Connect using the SSH key you specified during instance creation:

ssh [email protected]

After a successful login, you should see the FreeBSD welcome banner and shell prompt:

FreeBSD 14.4-RELEASE releng/14.4-n269658 GENERIC

Welcome to FreeBSD!

freebsd@freebsd-server:~ %

The freebsd user has sudo privileges through the wheel group. Switch to root when you need elevated access:

sudo su -

If SSH times out, verify the security group rules from Step 4 and confirm the instance has network connectivity. Check the console log for boot errors:

openstack console log show freebsd-server

Step 7: Configure FreeBSD Post-Boot

Once logged in, run initial configuration tasks to get the system production-ready. Start by updating the package repository and installing essential packages:

sudo pkg update
sudo pkg upgrade -y

Install commonly needed packages for server administration:

sudo pkg install -y vim bash curl wget sudo git

Set the Timezone

The cloud image defaults to UTC. Set your local timezone by creating a symlink to the correct zoneinfo file:

sudo tzsetup

Alternatively, set it non-interactively by copying the zoneinfo file. For example, to set UTC:

sudo cp /usr/share/zoneinfo/UTC /etc/localtime

Verify the timezone is correct:

date

Create Additional Users

Create a regular user account and add it to the wheel group for sudo access. This is better than using the default freebsd user for day-to-day operations:

sudo pw useradd -n sysadmin -m -G wheel -s /usr/local/bin/bash

Set a password for the new user:

sudo passwd sysadmin

Copy your SSH key to the new user account for key-based authentication:

sudo mkdir -p /home/sysadmin/.ssh
sudo cp /home/freebsd/.ssh/authorized_keys /home/sysadmin/.ssh/
sudo chown -R sysadmin:sysadmin /home/sysadmin/.ssh
sudo chmod 700 /home/sysadmin/.ssh
sudo chmod 600 /home/sysadmin/.ssh/authorized_keys

Step 8: Grow the Root Filesystem

The FreeBSD cloud image ships with a small root partition. OpenStack provisions the disk size you specified in the flavor (20 GB in our case), but the filesystem inside the image does not automatically expand to fill it. You need to grow it manually.

First, check the current disk usage to see how much space the root filesystem is using:

df -h /

You will see the root partition is much smaller than the 20 GB disk. Identify the disk device and partition layout:

gpart show vtbd0

The output shows the GPT partition table with free space at the end of the disk:

=>       3  41943029  vtbd0  GPT  (20G)
         3       118      1  freebsd-boot  (59K)
       121   4194304      2  freebsd-swap  (2.0G)
   4194425  12582888      3  freebsd-ufs   (6.0G)
  16777313  25165719         - free -  (12G)

Recover any free space and resize the UFS partition to fill the disk:

sudo gpart recover vtbd0
sudo gpart resize -i 3 vtbd0
sudo growfs /

Confirm the filesystem has expanded by checking disk usage again:

df -h /

The root filesystem should now show approximately 18 GB available (20 GB minus swap and boot partitions).

Step 9: Create a Snapshot for Reuse

After configuring FreeBSD to your needs, create a snapshot of the running instance. This snapshot becomes a new Glance image you can use to launch pre-configured FreeBSD instances without repeating the setup steps.

Before taking the snapshot, clean up temporary files and package caches to keep the image lean:

sudo pkg clean -ya
sudo rm -rf /tmp/*
sudo rm -rf /var/tmp/*

Create the snapshot from the OpenStack CLI on your workstation (not from inside the FreeBSD instance):

openstack server image create \
  --name FreeBSD-14.4-configured \
  freebsd-server

Wait for the snapshot to finish. Monitor its status:

openstack image show FreeBSD-14.4-configured -c status

Once the status shows active, the snapshot is ready. You can now launch new instances from it just like you would from the original image:

openstack server create \
  --image FreeBSD-14.4-configured \
  --flavor freebsd.small \
  --security-group default \
  --key-name mykey \
  --network private-net \
  freebsd-from-snapshot

If you need to install FreeBSD on a local hypervisor instead, see our guide on installing FreeBSD on KVM or VirtualBox.

Conclusion

You now have a FreeBSD 14.4 instance running on OpenStack, with SSH access, package management configured, the root filesystem expanded, and a reusable snapshot saved. For production use, configure OpenStack networks and subnets with proper isolation, enable PF firewall rules on the FreeBSD instance, set up regular ZFS snapshots for backup, and restrict SSH access to key-based authentication only.

Related Articles

Openstack Install Magnum Container Service on OpenStack Cloud Install OpenStack on Rocky Linux 8 – Setup Keystone (Step 3) FreeBSD How To Install and Configure OPNSense Firewall Cloud OpenStack Deployment on CentOS 7 With Packstack

Leave a Comment

Press ESC to close