Skip to content

Instantly share code, notes, and snippets.

@c0m4r
Last active June 16, 2025 07:13
Show Gist options
  • Save c0m4r/0401f6b53d35b0c34a4f51eef68af377 to your computer and use it in GitHub Desktop.
Save c0m4r/0401f6b53d35b0c34a4f51eef68af377 to your computer and use it in GitHub Desktop.
FreeBSD installation on OVH VPS

FreeBSD installation on OVH VPS

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:

1. Rescue mode

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]

2. Disk preparation

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: 0x9fdc479e

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 6141951 6139904 2.9G 83 Linux

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: dos
Disk identifier: 0xbb326e04

Device 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

3. Download and deploy FreeBSD

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-002590EC5BF2

Device 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.

image

4. Post-installation

  • 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!

image

@kolmidad
Copy link

From my experience it seems that all or some VPS now use /21 (255.255.248.0) ipv4 subnet mask.
Anyway, this article was very useful. Thanks for it

@Veence
Copy link

Veence commented Jun 16, 2025

Works like a charm. Many thanks for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment