This guide explains how to install the FreeBSD on OVH VPS. This might also work for other VPS providers with the proper rescue system in place.
Inspired by https://www.klajnszmit.net/unix-bsd-linux/openbsd-on-ovh-vps
Table of contents:
Log into OVHcloud, switch to your VPS control panel, select Boot -> Restart into Rescue Mode. It takes up to 3 minutes to boot into rescue mode. You can read the rescue root account password from KVM (Console) or from the link sent via email.
Let's copy our SSH Key into the rescue environment first for convenience and log in:
if [ ! -e ~/.ssh/id_ed25519 ] ; then ssh-keygen -t ed25519 ; fi
ssh-copy-id [email protected]
ssh [email protected]
Check available drives:
fdisk -l
[RESCUE] root@vps-XXXXXXXX:~ $ fdisk -l
Disk /dev/sda: 2.93 GiB, 3145728000 bytes, 6144000 sectors
Disk model: QEMU HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9fdc479eDevice Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 6141951 6139904 2.9G 83 LinuxDisk /dev/sdb: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: QEMU HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbb326e04Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 83886079 83884032 40G 83 Linux
We are interested in /dev/sdb, which is our VPS's drive. We need to wipe what's left on that drive and exit back to our local machine:
wipefs -a /dev/sdb
exit
We will use the FreeBSD VM image which includes everything we need.
Head over to freebsd.org/where and choose VM -> amd64 of the latest release.
At the time of writing this it was 14.0.
Download *-amd64.raw.xz
wget https://download.freebsd.org/releases/VM-IMAGES/14.0-RELEASE/amd64/Latest/FreeBSD-14.0-RELEASE-amd64.raw.xz
And then transfer it over ssh:
cat FreeBSD-14.0-RELEASE-amd64.raw.xz | ssh [email protected] "xz -dc | dd of=/dev/sdb bs=1M"
Now make sure that everything went as expected:
ssh [email protected]
fdisk -l /dev/sdb
You should see something like this:
Disk /dev/sdb: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: QEMU HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 085DD663-7FB6-11EE-A7BA-002590EC5BF2Device Start End Sectors Size Type
/dev/sdb1 34 155 122 61K FreeBSD boot
/dev/sdb2 156 66739 66584 32.5M EFI System
/dev/sdb3 66740 2163891 2097152 1G FreeBSD swap
/dev/sdb4 2163892 12649651 10485760 5G FreeBSD UFS
Don't worry about the /dev/sdb4 size, it will extend itself after first boot.
Now restart your VPS via the OVH control panel ($ reboot won't work).
FreeBSD should now boot and you can continue your setup via KVM (Console) with FreeBSD Handbook.
- Change root password:
passwd
- Update the system:
pkg update
- Install useful stuff:
pkg install bash bash-completion bind-tools curl gnu-watch htop lsblk lsof mc mtr-nox11 nano vim wget whois
- Enable the SSH Server
- Take care of Security
If you found this article helpful, please consider making donation to a charity on my behalf. Thank you.
Enjoy your FreeBSD adventure!
Thank you very much for this short tutorial, it worked like a charm!
However, after the successful installation, I had to troubleshoot some issues.
I will let some information below for the people who will use this guide in the future.
Before starting, collect those information:
- hostname
it should look like "vps-********.vps.ovh.net"
- static IPv4 and IPv6 addresses, and the IPv6 gateway
Found on OVH dashboard (OVH Bare Metal Cloud -> VPS dashboard)
- OVH DNS IPv4 address
it should resolve to "cdns.ovh.net." (I found it in a YAML file in /etc/netplan/ on Ubuntu 23.xx before starting the rescue mode)
VPS used
FreeBSD VM image used
Don't forget to update your xz package, 5.6.0 and 5.6.1 are compromised!
Disk partitions
The disk partition was 1 GB of swap, the rest for /usr. I expected 2-4 GB of swap and different partitions for /var, /tmp and /usr.
I guess one would need to create its own VM image, with QEMU or something like that.
Keyboard layout
By default, the keyboard is QWERTY.
To find the keyboard layout you want, type
kbdmap
.You will be able to select your layout, and its name will be displayed in the console.
The layout will NOT change however.
You need to add the following line to your /etc/rc.conf file:
keymap="<your layout name>"
.example:
keymap="ch-fr.kbd"
Network configuration initially correct, but rc.conf incorrect
After logging with OVH's KVM, the system was working fine:
However, /etc/rc.conf was FULL of crap:
IF YOU RUN
service netif restart && service routing restart
, YOUR NETWORK AND DNS CONFIG WILL BE MESSED UP.Following the Network chapter of the FreeBSD handbook was enough to fix that.
My final rc.conf looked like this:
And /etc/resolv.conf like this:
Run
service netif restart && service routing restart
, check that both files are still correct and check thatping -c2 www.FreeBSD.org
is working too.Now you can continue with the Security chapter of the FreeBSD handbook.