Bootstrap OpenBSD

Page content

Bootstrapping VM

It’s always good to have Templates. Isn’t it ? Sometime, with a lot of stuff preconfigured and installed. Sometimes, a fresh install without anything (except syspatches). Here a little Helper, how to Build a OpenBSD Template with 20GB, resp. 40GB Disk Size.

This stuff was tested on www.hetzner.de, so you should be able to reproduce it in a few minutes.

Costs: CX11,  1 CPU, 2 GB RAM, 20 GB Disk, 20TB Traffic -> 2.68 Euro/Month
Costs: CPX11, 2 CPU, 2 GB RAM, 40 GB Disk, 20TB Traffic -> 3.76 Euro/Month

If you create an Account, you can use my sponsor link and we both get “a few bucks” to play with …

Order a VM, mount the latest OpenBSD ISO from their Library and boot from the CD …

VM with 20G Disk

Bootstrap OpenBSD 7.x

2CPU, 2GB, 20GB Disk

install:  i
keyboard: sg
hostname: template-20g
nic:      vio0
ipv4:     dhcp
ipv6:     none
domain:   your-domain-bla
passwd:   xxxxxx
ssh:      yes
xwin:     no
com0:     no
user:     no
ssh root: yes
timez:    Europe/Zurich

disk:     sd0
mbr:      w
layout:   c

a a 2G  /
a b 1G  swap
a d 1G  /tmp
a e 4G  /home
a f 4G  /usr
a g *   /var
w
x

set:  cd0
path: 7.x/amd64

-x*
xb*
done
SHA256: yes

installing ... 

show disk layout

template-20g# df -h |sort |grep -v File
/dev/sd0a      1.9G   64.7M    1.8G     3%    /
/dev/sd0d      987M   10.0K    937M     0%    /tmp
/dev/sd0e      3.9G    2.0K    3.7G     0%    /home
/dev/sd0f      3.9G    1.2G    2.5G    32%    /usr
/dev/sd0g      6.8G   49.0M    6.4G     1%    /var

remove keys and shut

rm /etc/ssh/ssh_host_*
halt -p

-> snapshot template-20g-xxx

VM with 40G Disk

Bootstrap OpenBSD 7.x

2CPU, 2GB, 40GB Disk

install:  i
keyboard: sg
hostname: template-40g
nic:      vio0
ipv4:     dhcp
ipv6:     none
domain:   your-domain-bla
passwd:   xxxxxx
ssh:      yes
xwin:     no
com0:     no
user:     no
ssh root: yes
timez:    Europe/Zurich

disk:     sd0
mbr:      w
layout:   c

a a 4G  /
a b 2G  swap
a d 2G  /tmp
a e 4G  /home
a f 8G  /usr
a g 8G  /var
a h *   /data
w
x

set:  cd0
path: 7.x/amd64

-x*
xb*
done
SHA256: yes

installing ... 

syspatch

show disk layout

template-40g# df -h |sort |grep -v File
/dev/sd0a      3.9G    102M    3.6G     3%    /
/dev/sd0d      1.9G   10.0K    1.8G     0%    /tmp
/dev/sd0e      3.9G    2.0K    3.7G     0%    /home
/dev/sd0f      7.9G    1.2G    2.5G    16%    /usr
/dev/sd0g      7.8G    6.8M    7.4G     0%    /var
/dev/sd0h      9.7G    2.0K   13.0G     0%    /data

-> snapshot template-40g-xxx

Packages

install some useful packages …

pkg_add \
bash-- \
borgbackup-- \
coreutils-- \
curl-- \
git-- \
gnuwatch-- \
htop-- \
pkglocatedb-- \
pstree-- \
py3-pip-- \
python--%3.9 \
quirks-- \
rsync-- \
tree-- \
vim--no_x11 \
wget--

ln -sf /usr/local/bin/pip3.9 /usr/local/bin/pip

sha256: 230f5c26ae2c7b077d53cef1c6575692e575184a20f546aef329b0fc1175a9c1