BSD · Cloud · FreeBSD · Glance · IceHouse · Image Management · Image Service · Juno · Kilo · Liberty · OpenStack

Bundling FreeBSD image with Cloud-Init for OpenStack

This article is about how to create a FreeBSD 10.x image for use with OpenStack.The following method was tested with FreeBSD 10.2 image bundled into Liberty version of OpenStack running on Ubuntu 14.04 LTS. However this can also be used with the previous versions of OpenStack like Havana, Icehouse, Juno and Kilo.

Virtual Hard drive

Create an image needed for Hard-drive emulation

qemu-img create -f qcow2 freebsd.img 10G

FreeBSD installation

Start the Virtual Machine to boot from the CD.

kvm -m 512 -cdrom FreeBSD-10.2-RELEASE-amd64-disc1.iso -drive file=freebsd.img,if=virtio -boot d -net nic,model=virtio -net user -nographic -vnc :1

Connect to the Virtual Machine through VNC (use display number :1) where is the IP address of the host machine.

vncviewer :1

During installation enable SSH server, IPV4 and DHCP for the interface “vtnet0”. Shutdown the Virtual Machine.

Post installation tasks

Boot the virtual from hard drive to perform the post installation tasks.

kvm -m 1024 -drive file=freebsd.img -boot c -net nic -net user -nographic -vnc :1

Verify if the following line is present in the file /etc/rc.conf. If not append it to the file.

Network configuration


SSH server configuration

Edit the following lines as below in /etc/ssh/sshd_config, for SSH access as root and to enable password authentication.

PermitRootLogin yes
PasswordAuthentication yes

Cloud-Init installation

Install Cloud-Init using the following commands

fetch --no-verify-peer
chmod +x

Do other necessary changes needed for the image and shutdown the Virtual Machine.

Uploading to OpenStack

Upload the image to OpenStack using the following command

glance image-create --name 'FreeBSD-10.2'   --container-format bare   --disk-format qcow2   --file freebsd.img  --is-public True

Now you can boot instances from this image and login to the instances with the user “freebsd” using your private key.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s