# How to install NetBSD on OVH
[Kimsufi](https://www.kimsufi.com/) offers dedicated servers starting from single core 1.8GHz Intel Atom D425 with 2GB RAM and 500GB disk and various operating systems at a reasonable price. They do not have NetBSD images available to install, but it can be installed with a little persistence. Decide on your required machine specification and purchase that. This example was based on KS-5, an AMD Opteron 4122 4core with 16GB RAM and 2TB disk.
You need an install image available to fetch with wget, such as the ones on the NetBSD servers.
Note the IP address of your server, available in the Kimsufi control panel.
Before installing NetBSD, it could be a good idea to install first a provided Linux image. Because you will have then a Linux dmesg
. This will give you supplementary informations about the hardware and the booting sequence: it is the second line of the dmesg
and is introduced by Command line:
. Specially, if the Linux kernel was booted with nomodeset
, it is a safe guess that NetBSD will not be able to drive the framebuffer and enabling it could crash the kernel. We will see below how to first boot NetBSD more safely without the framebuffer by writing a /boot.cfg
file.
In the Kimsufi control panel disable monitoring as this would alert a technician if your machine seems to be having problems. You can re-enable that later.
Then click on Netboot, choose Rescue and pick one of the rescue images from the drop down menu. I used the Linux based rescue64-pro though they have FreeBSD versions also. Choose Next, and Confirm that.
Now you can Restart the server which may take a short time and you will get an email with login details for the rescue image.
In my case, the Rescue system was running entirely in RAM. I don't know how the smaller systems would manage with a NetBSD install image, perhaps you would have to partition the disk and mount a portion. Download the install image and uncompress it:
wget https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.2/images/NetBSD-9.2-amd64-install.img.gz
gzip -d NetBSD-9.2-amd64-install.img.gz
As I had had a different installation previously, I ensured the disk was clear of partition information (this is for MBR partitioned disks; for a GPT partitioned one, you will have to destroy
the GPT, using the dedicated tool, due to the presence of a GPT backup at the end of the disk that will resurrect the partition even if the initial GPT table has been erased):
dd if=/dev/zero of=/dev/sda bs=1M count=10
Boot up the installation with QEMU:
qemu-system-x86_64 -net nic -net user,hostfwd=tcp::3389-:3389 -localtime -enable-kvm -m 1G -k en-gb -hda NetBSD-9.2-amd64-install.img -hdb /dev/sda -vnc :0
The console is available via VNC, from your local machine:
vncviewer :5900
You should be able to do a normal installation to wd0, then shutdown -p and QEMU will exit. You can test that the disk boots and do any further configuration you require.
qemu-system-x86_64 -net nic -net user,hostfwd=tcp::3389-:3389 -localtime -enable-kvm -m 1G -k en-gb -hda /dev/sda -vnc :0
vncviewer :5900
At the least, ensure that you have a network configured, add
dhcpcd=YES
to /etc/rc.conf.
If the server has an IPv6 address too, add
ip6mode="autohost"
to /etc/rc.conf.
Create a user, add your SSH keys to authorized_keys and disable PasswordAuthentication and RootLogin in /etc/ssh/sshd_config.
Then configure the boot sequence to first run (on real hardware) with the framebuffer disabled. If it works, you can then test with it enabled (simply commenting out the userconf directive we set). To do so, create or edit /boot.cfg
with this (here the framebuffer device i915drmkms
is an example; look at the real hardware to find the corresponding device to disable in your case---read man 4 drm
):
menu=Boot normally:rndseed /var/db/entropy-file;boot
menu=Boot single user:rndseed /var/db/entropy-file;boot -s
menu=Drop to boot prompt:prompt
default=1
timeout=5
clear=1
userconf=disable i915drmkms*
Back in Kimsufi dashboard, click Netboot again and choose Hard Disk. Restart and wait a while and you should be able to SSH in to your dedicated NetBSD server.
(if you disabled monitoring, you can re-enable it again now)