These are my recipe for building a Pi-KVM v2 ‘DIY’ unit.
Ingredients:
- Using HDMI-to-CSI adapter from Aliexpress, probably any adapter is fine.
- Print out case from thingiverse. Alternatives are available.
- Using USB-C Y adapter from thingiverse, maybe this version, many alternatives are available.
- Add 30x30x7 Raspberry Pi fan, with heatsinks.
- Raspberry Pi 4 2GB
- Raspberry Pi 4 official power supply
- Short (6in) USB-C<->C cable
- Ethernet cable, long enough to go from pikvm to ethernet switch
- HDMI cable, long enough to go from pikvm to target.
- USB-C<->USB-A cable, long enough to go from pikvm to target.
- Wide (1/2″, or larger) Kapton tape.
- High temperature hot glue
- M2.5 hex flat-head screws, 6 & 10/12 mm.
Cleaning print:
- Carefully slice/file/cut off supports for part XXX on screw tabs.
- File out hole for USB-C connecter on both plastic parts, to increase size of USB-C connector that can fit.
Mounting holes for HDMI-to-CSI adapter don’t match print, and are inaccessible anyway. Instead after test fitting the HDMI board to make sure it fits cleanly in the slot and the HDMI port lines up, squirt a good amount of high-temp hot glue into the two mounting slots, and push the HDMI board in, and keep it lined up at a flat angle with the connector clear from the outside until the glue cools.
Test fit (probably without the flex cable) to make sure raspberry pi slides in, and all case parts come together; clean up any edges needed to make sure that all screw holes line up.
Add flat-flex from HDMI adapter to ‘camera’ interface on rasperry pi board.
Screw together case parts with long screws for the non-port end of the case, short screws everywhere else.
Connect short USB-C/C cable to ‘power/data’ side of Y adapter, and to Raspberry PI.
Connect power adapter to ‘power’ port of Y adapter.
Connect USB-C/A cable to ‘data’ port of Y adapter.
Consider enclosure of Y adapter, or just wrap in Kapton tape.
Boot, should show up on pikvm.local, via web. Default login for web UI is admin/admin. Root has password ‘root’.
Log into shell, execute:
rw
pacman -Syy
pacman -Su # Update packages
echo 'pikvm1' > /etc/hostname
# modify /etc/kvmd/meta.yaml to replace localhost.localserver with the FQDN of the machine
nano /etc/kvmd/meta.yaml
reboot
It’s important to rename the machine if you’ll have more than one, as the default name is always pikvm.
(Any errors about ‘read only file-system’ indicate you need to run ‘rw’ to make the filesystems temporarily writable.)
Next we’ll set up Let’s Encrypt to get a proper certificate. This is using acme.sh with a DNS-verified certificate, through cloudflare, with the Let’s Encrypt CA. Please adjust accordingly; I’m using DNS certs as these machines are not publically visible, and cannot use http verification.
rw
# Get crontab support
pacman -S cronie
# Install acme.sh
curl https://get.acme.sh | sh -s email=xxx@yyy
exit
# restart shell
rw
CF_Key="xxx" CF_Email="yyy@zzz" acme.sh --server letsencrypt --issue --dns dns_cf -d pikvm1.mydomain.com
acme.sh -d pikvm1.mydomain.com--install-cert --cert-file /etc/kvmd/nginx/ssl/server.crt --key-file /etc/kvmd/nginx/ssl/server.key --reloadcmd "systemctl restart kvmd-nginx"
Edit root’s crontab to add rw and ro commands:
16 0 * * * rw ; "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null ; ro