How To Run FreeBSD 13 / FreeBSD 12 on OpenStack

Posted on 81 views

How can i add FreeBSD 12 / FreeBSD 13 Cloud image to OpenStack?, How do i create FreeBSD 13/12 instances on OpenStack platform. FreeBSD is an open source Unix based operating system used to power embedded systems, modern servers and desktops. The FreeBSD has a large community which continues to develop it for more than thirty years now. It comes with advanced security, networking, and storage features which fits to all types of systems – Embedded, busy websites, storage devices e.t.c.

In this guide, we will look at how you can run FreeBSD 12 / FreeBSD 13 on OpenStack.

Step 1: Download FreeBSD 13 / FreeBSD 12 qcow2 image

There are pre-installed virtual machine images available for the amd64 (x86_64), i386 (x86_32), and AArch64 (arm64) architectures in QCOW2, VHD, and VMDK disk image formats, as well as raw (unformatted) images.

I’ll download the latest release for amd64 (x86_64).

# FreeBSD 13
wget https://download.freebsd.org/ftp/releases/VM-IMAGES/13.0-RELEASE/amd64/Latest/FreeBSD-13.0-RELEASE-amd64.qcow2.xz

# FreeBSD 12
wget https://download.freebsd.org/ftp/releases/VM-IMAGES/12.0-RELEASE/amd64/Latest/FreeBSD-12.0-RELEASE-amd64.qcow2.xz

Step 2: Upload FreeBSD 12 image to OpenStack Glance

After the file is downloaded, we’ve to upload it to OpenStack Glance image service. The file format is .xz, check our guide on

How to extract .xz files on Linux – CenOS / Ubuntu / Debian

With unxz installed, extract the file.

# FreeBSD 13
xz --decompress FreeBSD-13.0-RELEASE-amd64.qcow2.xz

# FreeBSD 12
xz --decompress FreeBSD-12.0-RELEASE-amd64.qcow2.xz

After extraction, a file with .qcow2 extension is created.

$ file FreeBSD-12.0-RELEASE-amd64.qcow2
FreeBSD-12.0-RELEASE-amd64.qcow2: QEMU QCOW Image (v2), 33286062080 bytes

$ file FreeBSD-13.0-RELEASE-amd64.qcow2
FreeBSD-13.0-RELEASE-amd64.qcow2: QEMU QCOW Image (v2), 5402918912 bytes

Upload the image to Glance – From CLI or GUI

# FreeBSD 13
openstack image create  \
 --container-format bare \
 --disk-format qcow2     \
 --file FreeBSD-13.0-RELEASE-amd64.qcow2 \
 FreeBSD13

# FreeBSD 12
openstack image create  \
 --container-format bare \
 --disk-format qcow2     \
 --file FreeBSD-12.0-RELEASE-amd64.qcow2 \
 FreeBSD12

If the upload was successful, the image should be viewable.

$ openstack image list
+--------------------------------------+-----------+--------+
| ID                                   | Name      | Status |
+--------------------------------------+-----------+--------+
| b8d75f31-fb6b-428b-8b83-f3904b0bd114 | CentOS-7  | active |
| 92c5d5c5-5ca7-4adc-8244-456189ffdae1 | CentOS8   | active |
| fbcf16a0-c7cc-42c1-b836-a39bc34c9666 | Cirros    | active |
| d900bcad-047a-4d01-bcbc-42426bb4315d | CoreOS    | active |
| f0ac705b-ee73-4de8-95f7-4e06569f0f5c | Debian-10 | active |
| 01e6f07b-ca99-439d-9cd0-ab28c2573abf | Fedora-30 | active |
| 73f78fb0-1dc4-4a56-a432-622bf90f53e1 | FreeBSD13 | active |
| 1953e548-779c-4fe5-86c1-854d71f35d14 | FreeBSD12 | active |
| 7bd462ad-cc11-4d89-8b85-9aab0cfe114b | Ubuntu-18 | active |
| 86e42aae-d959-4b79-b9a4-b899d85ba303 | fed31     | active |
| 3a56d733-de76-490a-9dac-1419219b5803 | manageiq  | active |
| 47b5b6ed-5599-420a-a602-35d964e86de5 | rhcos     | active |
| 6b3dc49b-a53f-4cfc-98e0-9eb6925219de | rhel-7    | active |
| 965cb833-b97e-4488-9bc6-84495b9a9b7b | rhel-8    | active |
+--------------------------------------+-----------+--------+

$ openstack keypair list
+---------+-------------------------------------------------+
| Name    | Fingerprint                                     |
+---------+-------------------------------------------------+
| admin   | 19:7b:5c:14:a2:21:7a:a3:dd:56:c6:e4:3a:22:e8:3f |
+---------+-------------------------------------------------+

$ openstack network list
+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 44b32734-4798-403c-85e3-fbed9f0d51f2 | private | 1d1f6a6d-9dd4-480e-b2e9-fb51766ded0b |
| 70ea2e21-79fd-481b-a8c1-182b224168f6 | public  | 8244731c-c119-4615-b134-cfad768a27d4 |
+--------------------------------------+---------+--------------------------------------+

$ openstack flavor list
+--------------------------------------+------------+-------+------+-----------+-------+-----------+
| ID                                   | Name       |   RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------------------------------------+------------+-------+------+-----------+-------+-----------+
| 1                                    | m1.tiny    |  1024 |   10 |         0 |     1 | True      |
| 2                                    | m1.small   |  2048 |   20 |         0 |     2 | True      |
| 3                                    | m1.medium  |  4096 |   30 |         0 |     2 | True      |
| 4                                    | m1.large   |  8192 |   40 |         0 |     4 | True      |
| 5                                    | m1.xlarge  | 16384 |   50 |         0 |     8 | True      |
| 6                                    | m1.xxlarge | 32768 |   60 |         0 |    16 | True      |
| 66                                   | m1.manila  |   512 |    1 |         0 |     1 | True      |
+--------------------------------------+------------+-------+------+-----------+-------+-----------+

$ openstack security group list
+--------------------------------------+----------------------+------------------------+----------------------------------+------+
| ID                                   | Name                 | Description            | Project                          | Tags |
+--------------------------------------+----------------------+------------------------+----------------------------------+------+
| 0590e14a-6606-4079-9c73-608f8f44f905 | default              | Default security group | d8dbf1834d364dadb644d4f648c08f99 | []   |
| 17647d74-533f-4ff8-b692-f2e52ec011bf | permit_all           | Allow all ports        | d8dbf1834d364dadb644d4f648c08f99 | []   |
| 2714780a-d61c-445d-b653-3188e8221962 | default              | Default security group | 57d04dc644ec4b09ae619d873d17d002 | []   |
| 3c5f433b-4892-4f5e-80bb-aa68d93dc426 | default              | Default security group |                                  | []   |
| 6bd8d8ba-d0c6-44c1-9ecb-c4b236f9806e | default              | Default security group | cd220eebeb374ea3af57b7b6395dee34 | []   |
| 81da6654-5deb-4941-a26b-0850bd7582b9 | lb-default-sec-group | lb-default-sec-group   | cd220eebeb374ea3af57b7b6395dee34 | []   |
+--------------------------------------+----------------------+------------------------+----------------------------------+------+

Step 3: Create FreeBSD 12 Instance on OpenStack

With the FreeBSD 12 image uploaded, we can create a FreeBSD 12 server on OpenStack.

# FreeBSD 13
openstack server create \
 --image FreeBSD13 \
 --key-name admin \
 --flavor m1.medium \
 --security-group  permit_all  \
 --network public  \
 FreeBSD13

# FreeBSD 12
openstack server create \
 --image FreeBSD12 \
 --key-name admin \
 --flavor m1.medium \
 --security-group  permit_all  \
 --network public  \
 FreeBSD12

Your server should be created in a few seconds. Our next guide will convert how to create FreeBSD Qemu/KVM Virtual Machine template.

Step 4: Open FreeBSD Instance Console

Login to OpenStack Horizon Dashboard and navigate to Project > Compute > Instances > FreeBSD instance > Console

run-freebsd-openstack-001-1024x368

Login as root user

run-freebsd-openstack-002-1024x95

It will not ask for any password.

run-freebsd-openstack-002-1024x95

Set root password:

# passwd
Changing local password for root
New Password:
Retype New Password:

Set sshd_enable to YES in /etc/rc.conf

# vi /etc/rc.conf
sshd_enable="YES"

Install vim

# pkg install vim

Enable Password Authentication and root login:

# vim /etc/ssh/sshd_config
PasswordAuthentication yes
PermitRootLogin yes

Then start sshd service:

# /etc/rc.d/sshd start

Copy your SSH key:

# ssh-copy-id [email protected]

You can then disable password authentication:

# vim /etc/ssh/sshd_config
PasswordAuthentication no

# /etc/rc.d/sshd stop
# /etc/rc.d/sshd start

 

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.