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 …

VM with 20G Disk

*** Bootstrap OpenBSD 6.8 ***

2CPU, 2GB, 20GB Disk

install:  i
keyboard: sg
hostname: template-20g
nic:      vio0
ipv4:     dhcp
ipv6:     none
domain:   noflow.ch
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: 6.8/amd64

-x*
xb*
done
SHA256: yes

installing ... 

remove iso, reboot and login via ssh

mkdir /root/.ssh && chmod 600 /root/.ssh
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIv1QwiWujY3x8F6TUe5iDy6syr8avQUw1rtinpiD0zb key1" >> /root/.ssh/authorized_keys
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMBF8pdGKSMMtCdLzBvMKGTJnIZ1VYwG4ZysYFxLJSXY key2" >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys

syspatch

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


rm /etc/ssh/ssh_host_*
halt -p
-> snapshot template-20g-xxx

VM with 40G Disk

*** Bootstrap OpenBSD 6.8 ***

2CPU, 2GB, ç0GB Disk

install:  i
keyboard: sg
hostname: template-40g
nic:      vio0
ipv4:     dhcp
ipv6:     none
domain:   noflow.ch
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 4G  /usr
a g 8G  /var
a h *   /data
w
x

set:  cd0
path: 6.8/amd64

-x*
xb*
done
SHA256: yes

installing ... 

remove iso, reboot and login via ssh

mkdir /root/.ssh && chmod 600 /root/.ssh
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIv1QwiWujY3x8F6TUe5iDy6syr8avQUw1rtinpiD0zb key1" >> /root/.ssh/authorized_keys
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMBF8pdGKSMMtCdLzBvMKGTJnIZ1VYwG4ZysYFxLJSXY key2" >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys

syspatch

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      3.9G    1.2G    2.5G    32%    /usr
/dev/sd0g      7.8G    6.8M    7.4G     0%    /var
/dev/sd0h     13.7G    2.0K   13.0G     0%    /data

rm /etc/ssh/ssh_host_*
halt -p
-> snapshot template-40g-xxx

Packages

we all need packages (and have got 1 minute …)

pkg_add \
bash-- \
borgbackup-- \
coreutils-- \
curl-- \
fping-- \
git-- \
gnuwatch-- \
gsed-- \
gtar-- \
htop-- \
lynx-- \
mtr-- \
pkglocatedb-- \
pstree-- \
pwgen-- \
py3-pip-- \
python--%3.8 \
quirks-- \
rsync-- \
tmate-- \
tree-- \
vim--no_x11 \
vnstat-- \
wget--

/usr/libexec/locate.updatedb &
ln -sf /usr/local/bin/pip3.8 /usr/local/bin/pip

sha256: 73b98bdb47b1d1a51cafbf66bb9ddf4d0bbd756af82536c7d752440519869c7f