Install FreeBSD 13.1 on Oracle Cloud
Oracle Cloud doesn’t propose FreeBSD like a lot of providers so we need to install it using a direct flash.
This is my initial setup phase and everything starts with an Always-Free running Oracle Linux.
Flashing FreeBSD 13.1
Connected using ssh and using root:
- You need to check that you have
wget
installed otherwise you need to install it:dnf install wget -y
- Identify your disk with
fdisk -l
, in my case it’s /dev/sda - Flashing: depends of your VM (AMD64 or AARCH64), you need to use the good one
# AMD64
| |
# AARCH64
| |
- Initiate the reboot using the dashboard: https://cloud.oracle.com
FreeBSD is now installed
Post-install steps
Using the console using the dashboard, let’s do a quick config and enable ssh.
Switch from quarterly to the latest repository (optional)
Depending if the version in quarterly is valid for your usage or not.
Update the system
Install packages
Let’s install a text editor, tmux, a sudo
alternative, a DHCP client doing IPv4 and IPv6 and OpenSSH
sudo
is also available but on FreeBSD, I prefer doas
Config doas
for group wheel
Config ssh server
In my case, I force post-install (before the configuration management run (ansible/saltstack)):
- PubkeyAuthentication yes
- PasswordAuthentication no
- PermitEmptyPasswords no
- VersionAddendum sycured
Tune the boot time
/etc/loader.conf
"0"
"0"
"YES"
"YES"
"none"
"YES"
Tune the system and services at boot
/etc/rc.conf
"oci-test"
"DHCP inet6 accept_rtadv"
"YES"
"YES"
"/usr/local/sbin/dual-dhclient"
"YES"
"NO"
"YES"
Create opc user
Change the password
Add you ssh public key
And finally, run the last reboot
Conclusion
This is a working way to have a FreeBSD when your provider doesn’t offer it.
I haven’t added a part about the firewall because the VM is already protected using security rules at the subnet level.
But you’ve 2 possibilities about the firewall:
- stateful: pf
- stateless: ipfw
If you want more information about pf, you can look at Packet Filter - OpenBSD Handbook.