This was adapted from this document
Download ISO image, then run:
openstack image create --file ~/Downloads/FreeBSD-12.0-RELEASE-amd64-disc1.iso --disk-format iso --container-format bare "FreeBSD-12.0-RELEASE-amd64-disc1.iso"
Set image_id
using id
of created image.
# The minimal FreeBSD installation requires around 600MB
openstack volume create --size 1 "FreeBSD-12.0-RELEASE-root"
Set volume_id
using id
of created volume.
Next, boot the installer:
openstack server create --image=$image_id --key-name $ssh_key --flavor m1.small --network $network_id --block-device-mapping "vdb=$volume_id:::0" "FreeBSD-12.0-RELEASE-install"
Set install_vm_id
using id
of created VM.
Now go to the OpenStack console for this VM, and run through the installation sequence:
- Perform standard FreeBSD install
- Distribution select: No package sets (keep minimal)
- Partitioning: Auto (ZFS)
- Partition: Set swap partition to 0, use stripe
- Root password: toor (temporary)
- Network configuration: vtnet0, IPv4 DHCP, IPv6 SLAAC, default resolver setup
- Clock: UTC
- Timezone: UTC
- System configuration: sshd, dumpdev
- System hardening: Clean /tmp, Disable remote syslog, Disable sendmail
- Add user accounts: None
- Open shell
- run
shutdown -p now
- run
Now stop and remove the installation VM, retaining the volume:
# Seems pointless if already stopped; can be skipped
openstack server stop $install_vm_id
openstack server remove volume $install_vm_id" "$volume_id
openstack server delete $install_vm_id
- Make the volume bootable using Horizion UI
- Start up a new VM using our installation volume using Horizon UI
cat <<EOF >>/boot/loader.conf
console="comconsole,vidconsole"
autoboot_delay="1"
EOF
pkg install py26-cloud-init ca_root_nss
echo "cloudinit_enable="YES" >> /etc/rc.conf
Install dual-dhclient
pkg install dual-dhclient
Configure /etc/rc.conf accordingly
dhclient_program="/usr/local/sbin/dual-dhclient"
ifconfig_vtnet0="DHCP"
ifconfig_vtnet0_ipv6="inet6 accept_rtadv"
rtsold_enable="YES"
# Remove cloud-init configured settings from rc.conf
grep -v hostname= /etc/rc.conf |grep -v ifconfig_vtnet0= > /x && mv /x /etc/rc.conf
truncate -s0 /etc/resolv.conf
set history = 0
history -c
rm -rf /root/.ssh /root/.history
rm -rf /var/log/*
# Remove SSH keys
rm /etc/sshd/ssh_host*
# Remove temporary root password (only do this once you verified your setup!)
vipw # Exchange the password hash for root with *, analogue to the other system users
# Remove cloud-init configuration
rm -rf /run/cloud-init /var/lib/cloud
# In case you logged in using the default cloud-init user, make sure to remove the user as well
rmuser freebsd
# Shutdown the system
shutdown -p now
Remove the configuration VM:
openstack server delete "$configure_vm_id"
Finally, create an OpenStack image from this volume:
openstack image create --volume $volume_id FreeBSD-12.0-RELEASE
This will be used to create new VMs.