Home Assistant OSをIncusで動かす
Home Assistant OSをIncusで動かす
https://mforcen.dev/en/wabl/home-assistant-over-incus
code:sh
# mkdir -p ~/vm/home-assistant/
# cd ~/vm/home-assistant/
# Check latest version from https://github.com/home-assistant/operating-system/releases/
wget https://github.com/home-assistant/operating-system/releases/download/16.2/haos_ova-16.2.qcow2.xz
unxz haos_ova-16.2.qcow2.xz
Make metadata yml
The extension is .yaml not .yml
code:metadata.yaml
architecture: x86_64
creation_date: 1760391518
properties:
description: Home Assistant 16.2
os: HAOS
release: 20250908
code:sh
tar -czf metadata.tar.gz metadata.yaml
incus image import metadata.tar.gz haos_ova-16.2.qcow2 --alias haos16.2
code:sh
incus launch local:haos16.2 haos-server --vm \
-c limits.cpu=2 \
-c limits.memory=2GiB \
-c boot.autostart=true \
-c boot.autostart.delay=10 \
-c security.secureboot=false \
--device root,size=40GiB
# Get IP address for this VM in incusbr0 network
incus list
Caddyでリバースプロキシする
code:sh
sudo apt install caddy -y
code:Caddyfile
# HomeAssistant:8123 to Host:8123
:8123 {
reverse_proxy http://10.163.142.184:8123 {
header_up Host {host}
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
header_up X-Forwarded-Proto {scheme}
header_up X-Forwarded-Host {host}
}
}
code:sh
sudo systemctl status caddy
sudo systemctl reload caddy
sudo systemctl start caddy
Home Assistantのconfiguration.yamlでリバースプロキシを許可
code:sh
incus exec haos-server -- bash
vi /mnt/data/supervisor/homeassistant/configuration.yaml
code:yaml
# /config/configuration.yaml
http:
use_x_forwarded_for: true
trusted_proxies:
- 10.163.142.1
code:sh
ha core check
ha core restart
public