Install FreeBSD

Jul 5, 2021
2 min read
Jun 30, 2023 16:33 EEST

To install FreeBSD we will use the standard FreeBSD image (FreeBSD-13.1-RELEASE-amd64-disc1.iso) with a ZFS setup. Power down the virtual machine via the control panel and upload the FreeBSD image via SFTP to the /cdrom folder (FTP will not work, it will break after around 300 seconds).

Make sure you set optimization in control panel to BSD and keyboard to de. Delete the complete harddisc from control panel under Medien.

Now insert the FreeBSD image as media and start the machine. The FreeBSD installer starts.

  • Select Install
  • Select keyboard layout “German”
  • Define a hostname
  • Make sure kernel-dbg and lib32 is selected and click ok
  • Select Auto (ZFS)
  • I used default settings and clicked Install
  • Select “stripe”
  • Mark da0 and OK
  • Confirm with YES
  • Set the root password
  • configure network for vtnet0
  • Would you like to configure IPv4 for this interface, select Yes
  • Would you like to use DHCP to configure this interface, select No
  • Put your IP, subnet and Default Router
  • Would you like to configure IPv6 for this interface, select Yes
  • Would you like to try stateless address autoconfiguration (SLAAC), select No
  • Put your IPv6 and Default Router fe80::1%vtnet0
  • IPv6 DNS 1: 2a03:4000:0:1::e1e6
  • IPv6 DNS 2: 2a03:4000:8000::fce6
  • DNS 1: 46.38.225.230
  • DNS 2: 46.38.252.230
  • Select Region Europe -> ‘Germany’ -> Germany (most areas) (CEST)
  • For date and time correct it or chose Skip
  • Check local_unbound and select OK
  • On hardening options select OK
  • Would you like to add users to the installed system now, select Yes
  • Create a user, make sure you add other group wheel
  • Select Exit - Apply configuration and exit installer
  • On The installation is now finished. Before existing the installer, would you like to open a shell in the new system to make any final manual modifications, select No
  • Select Reboot

Switch off the machine from the control panel, remove the image and start the machine again.

Configure the network by editing /etc/rc.conf

zfs_enable="YES"
keymap="de.kbd"

hostname="xxxxxx"
ifconfig_vtnet0="inet xxx.xxx.xxx.xxx netmask 255.255.252.0"
defaultrouter="xxx.xxx.xxx.x"
ifconfig_vtnet0_ipv6="inet6 xxxx:xxxx:xxxx:xxxx::x/64"
ipv6_defaultrouter="fe80::1%vtnet0"

local_unbound_enable="YES"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"

Now copy your SSH keys to the server, as we restrict as next SSH access to key only. To restrict to key access, edit /etc/ssh/sshd_config:

echo "UsePAM no" >> /etc/ssh/sshd_config
service sshd restart

Verify that ssh login with password fails and only key authentication is working.

Install pkg:

pkg install -y pkg

Configure pkg to use latest and not quarterly branch:

mkdir -p /usr/local/etc/pkg/repos
cp /etc/pkg/FreeBSD.conf /usr/local/etc/pkg/repos

Edit /usr/local/etc/pkg/repos/FreeBSD.conf

  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",

Update:

pkg update
pkg upg

Related Posts