FreeBSD is Fun

Practical recipes for FreeBSD

Installing FreeBSD in OVH dedicated

Posted

by

Category

French giant OVH is, at least at the moment of writing these lines, the largest dedicated server provider worldwide. So it only makes sense that we want our system of choice to work out of the box with their dedicated server line, named by the marketing guys as Bare Metal to difference it from their offerings in the vaporous and comfy realm of the cloud.

Unfortunately, OVH does not provide a FreeBSD install option anymore as they used to for a long time, but nothing stops us from installing it ourselves. It just means we won’t get any support from them regarding this setup, which is no big deal anyhow as they were not particularly enthusiastic about it in the first place.

As for us, it gives us a chance to get a bit more intimate with the child of the Berkeley Software Distribution. The first step in our journey is to visit the FreeBSD Project website and find out what’s the flavour of the day: at the moment of writing this article, 12.3, and 13.1 are the only supported releases. I opt for 12.3 and scroll down the release announcement until I find a Download link.

https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.3/

From all the files available here, I opt to download the file name FreeBSD-12.3-RELEASE-amd64-disc1.iso, which is a CD image, and save it to my PC.

Booting the installation CD

In the OVH customer area we choose the Bare Metal menu and select the server where we want to perform the installation from the Dedicated Servers list. At the default tab, just make sure the boot option is set to hard disk rather than rescue and then proceed to the IPMI tab. Here you will find the KVM option. KVM is the acronym of Keyboard Video Mouse and allows us to use our server as if we were sitting in front of the machine. Press “Start a KVM session in the browser”.

After some 30 seconds a new button will appear, “Access a KVM session on your browser”. After clicking on it we will find ourselves in front of a console screen. Press the button in the top right, “Select Media”, and choose the FreeBSD iso file we downloaded earlier. Finally, open the Power Options drop down menu and Reset the machine.

After a couple of minutes, the machine should start booting. If everything is correct, we will see a Kilobytes count increase in the top right, which means the console is streaming the iso file from our PC. If it doesn’t boot the CD, try resetting again or pausing your AdBlock.

Eventually, FreeBSD will boot and a a dialog will show up asking what we want to do with the CD. We will choose “Install”.

Many options in the Installer can be left as default or chosen to our preferences, except for a couple that I will detail below. Use the up and down arrow keys and Enter to change options.

Installation options

Filesystem

At the time of choosing a filesystem, we will choose ZFS. In the ZFS Configuration screen we will use our arrow keys and change Pool/Type of Disks from stripe to mirror.

This creates a RAID type setup where both disks are mirrored, that is, one is a copy of the other. This means that if one of the disk breaks, you will not lose your data but you can continue working normally – eventually getting the faulty drive replaced by OVH support. This comes at the cost of half the capacity of your drive but believe me, it’s worth it – unless you happen to be storing large amounts of disposable data on your server, today’s drives are more than big enough for most purposes.

Press arrow up and then enter to Proceed with installation. You will now be prompted to choose the drives to use for our mirror. Usually these will be called nvd0 and nvd1. Use the space bar to select them and then move the cursor to the bottom and press enter to proceed.

Distribution

Under Distribution Select choose lib32.

Default services

When prompted to choose the default services to install, I recommend choosing local_unbound (caching DNS resolver – more on this later), sshd (the necessary SSH daemon) and ntpdate (check and correct our server’s date and time correct at boot time).

Network

When asked if we want to set up IPv4 and IPv6 at this time, we will choose YES and then let it set up automatically. At the Name server screen type . in the Search field and Proceed. If automatic network setup doesn’t work, choose NO iand follow the instructions below. If it does, just skip to the next section.

Once the installation is finished, we are offered the option to make manual modifications in the shell. Here’s where we will configure the network, as manual setup is required in OVH. To this end, we will edit the following files.

/etc/rc.conf

ifconfig_ix0="inet <PRIMARY IP> netmask 255.255.255.255 broadcast <PRIMARY IP>"
static_routes="gw1 gw2"
route_gw1="<gateway ip>/32 -iface <interface>"
route_gw2="default <GATEWAY IP>"

/etc/resolv.conf

nameserver 213.186.33.99

If you wonder what this IP address is, it’s the OVH DNS server. And in case you want to be clever and use Cloudflare (1.1.1.1) or Google’s (8.8.8.8) instead, you should be aware that OVH will route these addresses to their DNS.

Once the later change is saved and we’ve left the editor, type exit and enter to leave the shell and reboot.

Ready to rumble

Once the system is rebooted, all that’s left to do is to allow SSH to connect with root user* so we can continue our setup tasks in a more friendly environment

Edit /etc/ssh/sshd_config and uncomment and edit the following line:

PermitRootLogin yes

Save, exit and restart the ssh daemon for the changes to take effect:

service sshd restart

(*) This is of course not a secure setup and should be just a temporary solution allowing us to do the rest of the setup in a more comfortable environment than the KVM console. Once you are finished here, I recommend to set up SSH key authentication using the tutorial I have prepared to this effect.


Leave a Reply

Your email address will not be published. Required fields are marked *