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!
@patr1xcore due to a limited disk space on OVH VPS it's a bit tricky to deploy the image there. This is why I suggest to rebuild your VM with fresh ubuntu, then use wipefs inside rescue, download ISO locally (on your PC) and finally transfer it over SSH as mentioned in the gist.
if you want to do it inside rescue environment you might want to try something like:
however I haven't tested it so I can't tell if it's going to work this way