Skip to content

Instantly share code, notes, and snippets.

@bonelifer
Forked from thereisnotime/README.md
Created October 19, 2024 18:04
Show Gist options
  • Save bonelifer/85fe6543203b759bbc29302e2be0df89 to your computer and use it in GitHub Desktop.
Save bonelifer/85fe6543203b759bbc29302e2be0df89 to your computer and use it in GitHub Desktop.
Install Home Assistant Supervised on Debian 12

Setup HA Supervised on Debian 12

How to Run

  1. Do sudo su
  2. Copy-paste the script (it will reboot the machine)

NOTE: I am using with with Vagrat's shell provisioner as it is easier (with privileged execution).

Next Steps

I suggest doing SSH and firewall hardening on the server.

Additional Notes

This script has been tested on:

  • 4GB RAM, 4vCores
  • Linux bookworm 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 GNU/Linux
  • Docker Engine: 27.3.1, Docker Buildx: v0.17.1, runc version: v1.1.14-0-g2c9f560, containerd version: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
  • Packages:
root@bookworm:/home/vagrant# apt list --installed
Listing... Done
adduser/stable,now 3.134 all [installed]
alsa-topology-conf/stable,now 1.2.5.1-2 all [installed,automatic]
alsa-ucm-conf/stable,now 1.2.8-1 all [installed,automatic]
apparmor/stable,now 3.0.8-3 amd64 [installed]
apt-listchanges/stable,now 3.24 all [installed]
apt-utils/stable,now 2.6.1 amd64 [installed]
apt/stable,now 2.6.1 amd64 [installed]
base-files/stable,now 12.4+deb12u7 amd64 [installed]
base-passwd/stable,now 3.6.1 amd64 [installed]
bash-completion/stable,now 1:2.11-6 all [installed]
bash/stable,now 5.2.15-2+b7 amd64 [installed]
bind9-dnsutils/stable,stable-security,now 1:9.18.28-1~deb12u2 amd64 [installed]
bind9-host/stable,stable-security,now 1:9.18.28-1~deb12u2 amd64 [installed]
bind9-libs/stable,stable-security,now 1:9.18.28-1~deb12u2 amd64 [installed,automatic]
bluez/stable,now 5.66-1+deb12u2 amd64 [installed,automatic]
bsdextrautils/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed,automatic]
bsdutils/stable,stable-security,now 1:2.38.1-5+deb12u1 amd64 [installed]
bzip2/stable,now 1.0.8-5+b1 amd64 [installed]
ca-certificates/stable,now 20230311 all [installed]
chrony/stable,now 4.3-2+deb12u1 amd64 [installed]
cifs-utils/stable,now 2:7.0-2 amd64 [installed,automatic]
cloud-guest-utils/stable,now 0.33-1 all [installed,automatic]
cloud-image-utils/stable,now 0.33-1 all [installed,automatic]
cloud-initramfs-growroot/stable,now 0.18.debian13 all [installed]
cloud-utils/stable,now 0.33-1 all [installed,automatic]
containerd.io/bookworm,now 1.7.22-1 amd64 [installed]
coreutils/stable,now 9.1-1 amd64 [installed]
cpio/stable,now 2.13+dfsg-7.1 amd64 [installed]
cron-daemon-common/stable,now 3.0pl1-162 all [installed]
cron/stable,now 3.0pl1-162 amd64 [installed]
curl/stable,now 7.88.1-10+deb12u7 amd64 [installed]
dash/stable,now 0.5.12-2 amd64 [installed]
dbus-bin/stable,now 1.14.10-1~deb12u1 amd64 [installed,automatic]
dbus-daemon/stable,now 1.14.10-1~deb12u1 amd64 [installed,automatic]
dbus-session-bus-common/stable,now 1.14.10-1~deb12u1 all [installed,automatic]
dbus-system-bus-common/stable,now 1.14.10-1~deb12u1 all [installed,automatic]
dbus-user-session/stable,now 1.14.10-1~deb12u1 amd64 [installed,automatic]
dbus/stable,now 1.14.10-1~deb12u1 amd64 [installed]
debconf-i18n/stable,now 1.5.82 all [installed]
debconf/stable,now 1.5.82 all [installed]
debian-archive-keyring/stable,now 2023.3+deb12u1 all [installed]
debian-faq/stable,now 11.1 all [installed]
debianutils/stable,now 5.7-0.5~deb12u1 amd64 [installed]
diffutils/stable,now 1:3.8-4 amd64 [installed]
dirmngr/stable,now 2.2.40-1.1 amd64 [installed,automatic]
distro-info-data/stable,now 0.58+deb12u2 all [installed,automatic]
dmidecode/stable,now 3.4-1 amd64 [installed]
dmsetup/stable,now 2:1.02.185-2 amd64 [installed,automatic]
dns-root-data/stable,now 2024041801~deb12u1 all [installed,automatic]
dnsmasq-base/stable,now 2.89-1 amd64 [installed,automatic]
doc-debian/stable,now 11.3+nmu1 all [installed]
docker-buildx-plugin/bookworm,now 0.17.1-1~debian.12~bookworm amd64 [installed]
docker-ce-cli/bookworm,now 5:27.3.1-1~debian.12~bookworm amd64 [installed]
docker-ce-rootless-extras/bookworm,now 5:27.3.1-1~debian.12~bookworm amd64 [installed]
docker-ce/bookworm,now 5:27.3.1-1~debian.12~bookworm amd64 [installed]
docker-compose-plugin/bookworm,now 2.29.7-1~debian.12~bookworm amd64 [installed]
dosfstools/stable,now 4.2-1 amd64 [installed,automatic]
dpkg/stable,now 1.21.22 amd64 [installed]
e2fsprogs/stable,now 1.47.0-2 amd64 [installed]
eject/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed,automatic]
exfatprogs/stable,now 1.2.0-1+deb12u1 amd64 [installed,automatic]
fdisk/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed]
file/stable,now 1:5.44-3 amd64 [installed]
findutils/stable,now 4.9.0-4 amd64 [installed]
firmware-linux-free/stable,now 20200122-1 all [installed,automatic]
fuse3/stable,now 3.14.0-4 amd64 [installed,automatic]
gcc-12-base/stable,now 12.2.0-14 amd64 [installed]
gdisk/stable,now 1.0.9-2.1 amd64 [installed,automatic]
genisoimage/stable,now 9:1.1.11-3.4 amd64 [installed,automatic]
gettext-base/stable,now 0.21-12 amd64 [installed]
git-man/stable-security,now 1:2.39.5-0+deb12u1 all [installed,automatic]
git/stable-security,now 1:2.39.5-0+deb12u1 amd64 [installed,automatic]
gnupg-l10n/stable,now 2.2.40-1.1 all [installed,automatic]
gnupg-utils/stable,now 2.2.40-1.1 amd64 [installed,automatic]
gnupg/stable,now 2.2.40-1.1 all [installed,automatic]
gpg-agent/stable,now 2.2.40-1.1 amd64 [installed,automatic]
gpg-wks-client/stable,now 2.2.40-1.1 amd64 [installed,automatic]
gpg-wks-server/stable,now 2.2.40-1.1 amd64 [installed,automatic]
gpg/stable,now 2.2.40-1.1 amd64 [installed,automatic]
gpgconf/stable,now 2.2.40-1.1 amd64 [installed,automatic]
gpgsm/stable,now 2.2.40-1.1 amd64 [installed,automatic]
gpgv/stable,now 2.2.40-1.1 amd64 [installed]
grep/stable,now 3.8-5 amd64 [installed]
groff-base/stable,now 1.22.4-10 amd64 [installed]
grub-common/stable,stable-security,now 2.06-13+deb12u1 amd64 [installed,automatic]
grub-pc-bin/stable,stable-security,now 2.06-13+deb12u1 amd64 [installed,automatic]
grub-pc/stable,stable-security,now 2.06-13+deb12u1 amd64 [installed]
grub2-common/stable,stable-security,now 2.06-13+deb12u1 amd64 [installed,automatic]
gzip/stable,now 1.12-1 amd64 [installed]
homeassistant-supervised/now 1.8.0 all [installed,local]
hostname/stable,now 3.23+nmu1 amd64 [installed]
ifupdown/stable,now 0.8.41 amd64 [installed]
inetutils-telnet/stable,now 2:2.4-2+deb12u1 amd64 [installed]
init-system-helpers/stable,now 1.65.2 all [installed]
init/stable,now 1.65.2 amd64 [installed]
initramfs-tools-core/stable,now 0.142+deb12u1 all [installed,automatic]
initramfs-tools/stable,now 0.142+deb12u1 all [installed,automatic]
iproute2/stable,now 6.1.0-3 amd64 [installed]
iptables/stable,now 1.8.9-2 amd64 [installed]
iputils-ping/stable,now 3:20221126-1 amd64 [installed]
isc-dhcp-client/stable,now 4.4.3-P1-2 amd64 [installed]
isc-dhcp-common/stable,now 4.4.3-P1-2 amd64 [installed]
jq/stable,now 1.6-2.1 amd64 [installed]
keyutils/stable,now 1.6.3-2 amd64 [installed,automatic]
klibc-utils/stable,now 2.0.12-1 amd64 [installed,automatic]
kmod/stable,now 30+20221128-1 amd64 [installed]
krb5-locales/stable,stable-security,now 1.20.1-2+deb12u2 all [installed]
less/stable,stable-security,now 590-2.1~deb12u2 amd64 [installed]
libacl1/stable,now 2.3.1-3 amd64 [installed]
libaio1/stable,now 0.3.113-4 amd64 [installed,automatic]
libapparmor1/stable,now 3.0.8-3 amd64 [installed,automatic]
libapt-pkg6.0/stable,now 2.6.1 amd64 [installed]
libargon2-1/stable,now 0~20171227-0.3+deb12u1 amd64 [installed,automatic]
libasound2-data/stable,now 1.2.8-1 all [installed,automatic]
libasound2/stable,now 1.2.8-1+b1 amd64 [installed,automatic]
libassuan0/stable,now 2.5.5-5 amd64 [installed,automatic]
libatasmart4/stable,now 0.19-5 amd64 [installed,automatic]
libattr1/stable,now 1:2.5.1-4 amd64 [installed]
libaudit-common/stable,now 1:3.0.9-1 all [installed]
libaudit1/stable,now 1:3.0.9-1 amd64 [installed]
libblkid1/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed]
libblockdev-crypto2/stable,now 2.28-2 amd64 [installed,automatic]
libblockdev-fs2/stable,now 2.28-2 amd64 [installed,automatic]
libblockdev-loop2/stable,now 2.28-2 amd64 [installed,automatic]
libblockdev-part-err2/stable,now 2.28-2 amd64 [installed,automatic]
libblockdev-part2/stable,now 2.28-2 amd64 [installed,automatic]
libblockdev-swap2/stable,now 2.28-2 amd64 [installed,automatic]
libblockdev-utils2/stable,now 2.28-2 amd64 [installed,automatic]
libblockdev2/stable,now 2.28-2 amd64 [installed,automatic]
libbluetooth3/stable,now 5.66-1+deb12u2 amd64 [installed,automatic]
libbpf1/stable,now 1:1.1.0-1 amd64 [installed,automatic]
libbrotli1/stable,now 1.0.9-2+b6 amd64 [installed,automatic]
libbsd0/stable,now 0.11.7-2 amd64 [installed,automatic]
libbz2-1.0/stable,now 1.0.8-5+b1 amd64 [installed]
libc-bin/stable,now 2.36-9+deb12u8 amd64 [installed]
libc-l10n/stable,now 2.36-9+deb12u8 all [installed]
libc6/stable,now 2.36-9+deb12u8 amd64 [installed]
libcap-ng0/stable,now 0.8.3-1+b3 amd64 [installed]
libcap2-bin/stable,now 1:2.66-4 amd64 [installed,automatic]
libcap2/stable,now 1:2.66-4 amd64 [installed]
libcbor0.8/stable,now 0.8.0-2+b1 amd64 [installed,automatic]
libcom-err2/stable,now 1.47.0-2 amd64 [installed]
libcrypt1/stable,now 1:4.4.33-2 amd64 [installed]
libcryptsetup12/stable,now 2:2.6.1-4~deb12u2 amd64 [installed,automatic]
libcurl3-gnutls/stable,now 7.88.1-10+deb12u7 amd64 [installed,automatic]
libcurl4/stable,now 7.88.1-10+deb12u7 amd64 [installed,automatic]
libdb5.3/stable,now 5.3.28+dfsg2-1 amd64 [installed]
libdbus-1-3/stable,now 1.14.10-1~deb12u1 amd64 [installed,automatic]
libdebconfclient0/stable,now 0.270 amd64 [installed]
libdevmapper1.02.1/stable,now 2:1.02.185-2 amd64 [installed,automatic]
libduktape207/stable,now 2.7.0-2 amd64 [installed,automatic]
libdw1/stable,now 0.188-2.1 amd64 [installed,automatic]
libedit2/stable,now 3.1-20221030-2 amd64 [installed,automatic]
libefiboot1/stable,now 37-6 amd64 [installed,automatic]
libefivar1/stable,now 37-6 amd64 [installed,automatic]
libelf1/stable,now 0.188-2.1 amd64 [installed,automatic]
liberror-perl/stable,now 0.17029-2 all [installed,automatic]
libestr0/stable,now 0.1.11-1 amd64 [installed,automatic]
libevent-core-2.1-7/stable,now 2.1.12-stable-8 amd64 [installed,automatic]
libexpat1/stable-security,now 2.5.0-1+deb12u1 amd64 [installed,automatic]
libext2fs2/stable,now 1.47.0-2 amd64 [installed]
libfastjson4/stable,now 1.2304.0-1 amd64 [installed,automatic]
libfdisk1/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed,automatic]
libffi8/stable,now 3.4.4-1 amd64 [installed]
libfido2-1/stable,now 1.12.0-2+b1 amd64 [installed,automatic]
libfreetype6/stable,now 2.12.1+dfsg-5+deb12u3 amd64 [installed,automatic]
libfstrm0/stable,now 0.6.1-1 amd64 [installed,automatic]
libfuse2/stable,now 2.9.9-6+b1 amd64 [installed,automatic]
libfuse3-3/stable,now 3.14.0-4 amd64 [installed,automatic]
libgcc-s1/stable,now 12.2.0-14 amd64 [installed]
libgcrypt20/stable,now 1.10.1-3 amd64 [installed]
libgdbm-compat4/stable,now 1.23-3 amd64 [installed,automatic]
libgdbm6/stable,now 1.23-3 amd64 [installed,automatic]
libglib2.0-0/stable,now 2.74.6-2+deb12u3 amd64 [installed,automatic]
libglib2.0-bin/stable,now 2.74.6-2+deb12u3 amd64 [installed]
libglib2.0-data/stable,now 2.74.6-2+deb12u3 all [installed,automatic]
libgmp10/stable,now 2:6.2.1+dfsg1-1.1 amd64 [installed]
libgnutls30/stable,now 3.7.9-2+deb12u3 amd64 [installed]
libgpg-error0/stable,now 1.46-1 amd64 [installed]
libgpgme11/stable,now 1.18.0-3+b1 amd64 [installed,automatic]
libgssapi-krb5-2/stable,stable-security,now 1.20.1-2+deb12u2 amd64 [installed,automatic]
libgudev-1.0-0/stable,now 237-2 amd64 [installed,automatic]
libhogweed6/stable,now 3.8.1-2 amd64 [installed]
libicu72/stable,now 72.1-3 amd64 [installed,automatic]
libidn2-0/stable,now 2.3.3-1+b1 amd64 [installed]
libip4tc2/stable,now 1.8.9-2 amd64 [installed,automatic]
libip6tc2/stable,now 1.8.9-2 amd64 [installed,automatic]
libjansson4/stable,now 2.14-2 amd64 [installed,automatic]
libjemalloc2/stable,now 5.3.0-1 amd64 [installed,automatic]
libjim0.81/stable,now 0.81+dfsg0-2 amd64 [installed,automatic]
libjq1/stable,now 1.6-2.1 amd64 [installed,automatic]
libjson-c5/stable,now 0.16-2 amd64 [installed,automatic]
libk5crypto3/stable,stable-security,now 1.20.1-2+deb12u2 amd64 [installed,automatic]
libkeyutils1/stable,now 1.6.3-2 amd64 [installed,automatic]
libklibc/stable,now 2.0.12-1 amd64 [installed,automatic]
libkmod2/stable,now 30+20221128-1 amd64 [installed,automatic]
libkrb5-3/stable,stable-security,now 1.20.1-2+deb12u2 amd64 [installed,automatic]
libkrb5support0/stable,stable-security,now 1.20.1-2+deb12u2 amd64 [installed,automatic]
libksba8/stable,now 1.6.3-2 amd64 [installed,automatic]
libldap-2.5-0/stable,now 2.5.13+dfsg-5 amd64 [installed,automatic]
liblmdb0/stable,now 0.9.24-1 amd64 [installed,automatic]
liblocale-gettext-perl/stable,now 1.07-5 amd64 [installed,automatic]
liblockfile-bin/stable,now 1.17-1+b1 amd64 [installed]
liblognorm5/stable,now 2.0.6-4 amd64 [installed,automatic]
libltdl7/stable,now 2.4.7-7~deb12u1 amd64 [installed,automatic]
liblz4-1/stable,now 1.9.4-1 amd64 [installed]
liblzma5/stable,now 5.4.1-0.2 amd64 [installed]
libmagic-mgc/stable,now 1:5.44-3 amd64 [installed,automatic]
libmagic1/stable,now 1:5.44-3 amd64 [installed,automatic]
libmaxminddb0/stable,now 1.7.1-1 amd64 [installed,automatic]
libmbim-glib4/stable,now 1.28.2-1 amd64 [installed,automatic]
libmbim-proxy/stable,now 1.28.2-1 amd64 [installed,automatic]
libmbim-utils/stable,now 1.28.2-1 amd64 [installed,automatic]
libmd0/stable,now 1.0.4-2 amd64 [installed]
libmicrohttpd12/stable,now 0.9.75-6 amd64 [installed,automatic]
libmm-glib0/stable,now 1.20.4-1 amd64 [installed,automatic]
libmnl0/stable,now 1.0.4-3 amd64 [installed,automatic]
libmount1/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed]
libncursesw6/stable,now 6.4-4 amd64 [installed,automatic]
libndp0/stable,stable-security,now 1.8-1+deb12u1 amd64 [installed,automatic]
libnetfilter-conntrack3/stable,now 1.0.9-3 amd64 [installed,automatic]
libnettle8/stable,now 3.8.1-2 amd64 [installed]
libnewt0.52/stable,now 0.52.23-1+b1 amd64 [installed,automatic]
libnfnetlink0/stable,now 1.0.2-2 amd64 [installed,automatic]
libnfsidmap1/stable,now 1:2.6.2-4 amd64 [installed,automatic]
libnftables1/stable,now 1.0.6-2+deb12u2 amd64 [installed,automatic]
libnftnl11/stable,now 1.2.4-2 amd64 [installed,automatic]
libnghttp2-14/stable,stable-security,now 1.52.0-1+deb12u1 amd64 [installed,automatic]
libnl-3-200/stable,now 3.7.0-0.2+b1 amd64 [installed,automatic]
libnl-genl-3-200/stable,now 3.7.0-0.2+b1 amd64 [installed,automatic]
libnl-route-3-200/stable,now 3.7.0-0.2+b1 amd64 [installed,automatic]
libnm0/stable,now 1.42.4-1 amd64 [installed,automatic]
libnpth0/stable,now 1.6-3 amd64 [installed,automatic]
libnsl2/stable,now 1.3.0-2 amd64 [installed,automatic]
libnspr4/stable,now 2:4.35-1 amd64 [installed,automatic]
libnss-myhostname/stable,now 252.30-1~deb12u2 amd64 [installed,automatic]
libnss-resolve/stable,now 252.30-1~deb12u2 amd64 [installed,automatic]
libnss-systemd/stable,now 252.30-1~deb12u2 amd64 [installed]
libnss3/stable,now 2:3.87.1-1 amd64 [installed,automatic]
libntfs-3g89/stable,now 1:2022.10.3-1+b1 amd64 [installed,automatic]
libnuma1/stable,now 2.0.16-1 amd64 [installed,automatic]
libonig5/stable,now 6.9.8-1 amd64 [installed,automatic]
libp11-kit0/stable,now 0.24.1-2 amd64 [installed]
libpam-modules-bin/stable,now 1.5.2-6+deb12u1 amd64 [installed]
libpam-modules/stable,now 1.5.2-6+deb12u1 amd64 [installed]
libpam-runtime/stable,now 1.5.2-6+deb12u1 all [installed]
libpam-systemd/stable,now 252.30-1~deb12u2 amd64 [installed]
libpam0g/stable,now 1.5.2-6+deb12u1 amd64 [installed]
libparted-fs-resize0/stable,now 3.5-3 amd64 [installed,automatic]
libparted2/stable,now 3.5-3 amd64 [installed,automatic]
libpcap0.8/stable,now 1.10.3-1 amd64 [installed,automatic]
libpci3/stable,now 1:3.9.0-4 amd64 [installed,automatic]
libpcre2-8-0/stable,now 10.42-1 amd64 [installed]
libpcsclite1/stable,now 1.9.9-2 amd64 [installed,automatic]
libperl5.36/stable,now 5.36.0-7+deb12u1 amd64 [installed,automatic]
libpipeline1/stable,now 1.5.7-1 amd64 [installed,automatic]
libpng16-16/stable,now 1.6.39-2 amd64 [installed,automatic]
libpolkit-agent-1-0/stable,now 122-3 amd64 [installed,automatic]
libpolkit-gobject-1-0/stable,now 122-3 amd64 [installed,automatic]
libpopt0/stable,now 1.19+dfsg-1 amd64 [installed,automatic]
libproc2-0/stable,now 2:4.0.2-3 amd64 [installed,automatic]
libprotobuf-c1/stable,now 1.4.1-1+b1 amd64 [installed,automatic]
libpsl5/stable,now 0.21.2-1 amd64 [installed,automatic]
libpython3-stdlib/stable,now 3.11.2-1+b1 amd64 [installed,automatic]
libpython3.11-minimal/stable-security,now 3.11.2-6+deb12u3 amd64 [installed,automatic]
libpython3.11-stdlib/stable-security,now 3.11.2-6+deb12u3 amd64 [installed,automatic]
libqmi-glib5/stable,now 1.32.2-1 amd64 [installed,automatic]
libqmi-proxy/stable,now 1.32.2-1 amd64 [installed,automatic]
libqmi-utils/stable,now 1.32.2-1 amd64 [installed,automatic]
libqrtr-glib0/stable,now 1.2.2-1 amd64 [installed,automatic]
libreadline8/stable,now 8.2-1.3 amd64 [installed,automatic]
librtmp1/stable,now 2.4+20151223.gitfa8646d.1-2+b2 amd64 [installed,automatic]
libsasl2-2/stable,now 2.1.28+dfsg-10 amd64 [installed,automatic]
libsasl2-modules-db/stable,now 2.1.28+dfsg-10 amd64 [installed,automatic]
libseccomp2/stable,now 2.5.4-1+deb12u1 amd64 [installed]
libselinux1/stable,now 3.4-1+b6 amd64 [installed]
libsemanage-common/stable,now 3.4-1 all [installed]
libsemanage2/stable,now 3.4-1+b5 amd64 [installed]
libsepol2/stable,now 3.4-2.1 amd64 [installed]
libslang2/stable,now 2.3.3-3 amd64 [installed,automatic]
libslirp0/stable,now 4.7.0-1 amd64 [installed,automatic]
libsmartcols1/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed]
libsqlite3-0/stable,now 3.40.1-2 amd64 [installed,automatic]
libss2/stable,now 1.47.0-2 amd64 [installed]
libssh2-1/stable,now 1.10.0-3+b1 amd64 [installed,automatic]
libssl3/stable-security,now 3.0.14-1~deb12u2 amd64 [installed]
libstdc++6/stable,now 12.2.0-14 amd64 [installed]
libsystemd-shared/stable,now 252.30-1~deb12u2 amd64 [installed,automatic]
libsystemd0/stable,now 252.30-1~deb12u2 amd64 [installed]
libtalloc2/stable,now 2.4.0-f2 amd64 [installed,automatic]
libtasn1-6/stable,now 4.19.0-2 amd64 [installed]
libteamdctl0/stable,now 1.31-1 amd64 [installed,automatic]
libtext-charwidth-perl/stable,now 0.04-11 amd64 [installed,automatic]
libtext-iconv-perl/stable,now 1.7-8 amd64 [installed,automatic]
libtext-wrapi18n-perl/stable,now 0.06-10 all [installed,automatic]
libtinfo6/stable,now 6.4-4 amd64 [installed]
libtirpc-common/stable,now 1.3.3+ds-1 all [installed,automatic]
libtirpc3/stable,now 1.3.3+ds-1 amd64 [installed,automatic]
libuchardet0/stable,now 0.0.7-1 amd64 [installed,automatic]
libudev1/stable,now 252.30-1~deb12u2 amd64 [installed]
libudisks2-0/stable,now 2.9.4-4 amd64 [installed,automatic]
libunistring2/stable,now 1.0-2 amd64 [installed]
liburing2/stable,now 2.3-3 amd64 [installed,automatic]
libusb-1.0-0/stable,now 2:1.0.26-1 amd64 [installed,automatic]
libuuid1/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed]
libuv1/stable,stable-security,now 1.44.2-1+deb12u1 amd64 [installed,automatic]
libvolume-key1/stable,now 0.3.12-5+b1 amd64 [installed,automatic]
libwbclient0/stable,stable-security,now 2:4.17.12+dfsg-0+deb12u1 amd64 [installed,automatic]
libwrap0/stable,now 7.6.q-32 amd64 [installed,automatic]
libxml2/stable,now 2.9.14+dfsg-1.3~deb12u1 amd64 [installed,automatic]
libxtables12/stable,now 1.8.9-2 amd64 [installed,automatic]
libxxhash0/stable,now 0.8.1-1 amd64 [installed]
libzstd1/stable,now 1.5.4+dfsg2-5 amd64 [installed]
linux-base/stable,now 4.9 all [installed,automatic]
linux-image-6.1.0-25-amd64/stable,now 6.1.106-3 amd64 [installed,automatic]
linux-image-6.1.0-26-amd64/stable-security,now 6.1.112-1 amd64 [installed,automatic]
linux-image-amd64/stable-security,now 6.1.112-1 amd64 [installed]
locales/stable,now 2.36-9+deb12u8 all [installed]
login/stable,now 1:4.13+dfsg1-1+b1 amd64 [installed]
logrotate/stable,now 3.21.0-1 amd64 [installed]
logsave/stable,now 1.47.0-2 amd64 [installed]
lsb-release/stable,now 12.0-1 all [installed]
lsof/stable,now 4.95.0-1 amd64 [installed]
mailcap/stable,now 3.70+nmu1 all [installed,automatic]
man-db/stable,now 2.11.2-2 amd64 [installed]
manpages/stable,now 6.03-2 all [installed]
mawk/stable,now 1.3.4.20200120-3.1 amd64 [installed]
media-types/stable,now 10.0.0 all [installed]
mime-support/stable,now 3.66 all [installed]
modemmanager/stable,now 1.20.4-1 amd64 [installed,automatic]
mount/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed]
nano/stable,now 7.2-1+deb12u1 amd64 [installed]
ncurses-base/stable,now 6.4-4 all [installed]
ncurses-bin/stable,now 6.4-4 amd64 [installed]
ncurses-term/stable,now 6.4-4 all [installed]
netbase/stable,now 6.4 all [installed]
netcat-traditional/stable,now 1.10-47 amd64 [installed]
network-manager/stable,now 1.42.4-1 amd64 [installed]
nfs-common/stable,now 1:2.6.2-4 amd64 [installed,automatic]
nftables/stable,now 1.0.6-2+deb12u2 amd64 [installed]
ntfs-3g/stable,now 1:2022.10.3-1+b1 amd64 [installed,automatic]
openssh-client/stable,stable-security,now 1:9.2p1-2+deb12u3 amd64 [installed]
openssh-server/stable,stable-security,now 1:9.2p1-2+deb12u3 amd64 [installed]
openssh-sftp-server/stable,stable-security,now 1:9.2p1-2+deb12u3 amd64 [installed,automatic]
openssl/stable-security,now 3.0.14-1~deb12u2 amd64 [installed]
os-agent/now 1.6.0 amd64 [installed,local]
parted/stable,now 3.5-3 amd64 [installed,automatic]
passwd/stable,now 1:4.13+dfsg1-1+b1 amd64 [installed]
patch/stable,now 2.7.6-7 amd64 [installed,automatic]
pci.ids/stable,now 0.0~2023.04.11-1 all [installed,automatic]
pciutils/stable,now 1:3.9.0-4 amd64 [installed]
perl-base/stable,now 5.36.0-7+deb12u1 amd64 [installed]
perl-modules-5.36/stable,now 5.36.0-7+deb12u1 all [installed,automatic]
perl/stable,now 5.36.0-7+deb12u1 amd64 [installed]
pigz/stable,now 2.6-1 amd64 [installed,automatic]
pinentry-curses/stable,now 1.2.1-1 amd64 [installed,automatic]
polkitd/stable,now 122-3 amd64 [installed,automatic]
ppp/stable,now 2.4.9-1+1.1+b1 amd64 [installed,automatic]
procps/stable,now 2:4.0.2-3 amd64 [installed]
python-apt-common/stable,now 2.6.0 all [installed,automatic]
python3-apt/stable,now 2.6.0 amd64 [installed,automatic]
python3-certifi/stable,now 2022.9.24-1 all [installed,automatic]
python3-chardet/stable,now 5.1.0+dfsg-2 all [installed,automatic]
python3-charset-normalizer/stable,now 3.0.1-2 all [installed,automatic]
python3-dbus/stable,now 1.3.2-4+b1 amd64 [installed,automatic]
python3-debconf/stable,now 1.5.82 all [installed,automatic]
python3-debian/stable,now 0.1.49 all [installed,automatic]
python3-debianbts/stable,now 4.0.1 all [installed,automatic]
python3-distro-info/stable,now 1.5+deb12u1 all [installed,automatic]
python3-httplib2/stable,now 0.20.4-3 all [installed,automatic]
python3-idna/stable,now 3.3-1+deb12u1 all [installed,automatic]
python3-minimal/stable,now 3.11.2-1+b1 amd64 [installed,automatic]
python3-pkg-resources/stable,now 66.1.1-1 all [installed,automatic]
python3-pycurl/stable,now 7.45.2-3 amd64 [installed,automatic]
python3-pyparsing/stable,now 3.0.9-1 all [installed,automatic]
python3-pysimplesoap/stable,now 1.16.2-5 all [installed,automatic]
python3-reportbug/stable,now 12.0.0 all [installed]
python3-requests/stable,now 2.28.1+dfsg-1 all [installed,automatic]
python3-six/stable,now 1.16.0-4 all [installed,automatic]
python3-urllib3/stable,now 1.26.12-1 all [installed,automatic]
python3.11-minimal/stable-security,now 3.11.2-6+deb12u3 amd64 [installed,automatic]
python3.11/stable-security,now 3.11.2-6+deb12u3 amd64 [installed,automatic]
python3/stable,now 3.11.2-1+b1 amd64 [installed,automatic]
qemu-utils/stable,now 1:7.2+dfsg-7+deb12u7 amd64 [installed,automatic]
readline-common/stable,now 8.2-1.3 all [installed]
reportbug/stable,now 12.0.0 all [installed]
rpcbind/stable,now 1.2.6-6+b1 amd64 [installed,automatic]
rsyslog/stable,now 8.2302.0-1 amd64 [installed]
runit-helper/stable,now 2.15.2 all [installed,automatic]
sed/stable,now 4.9-1 amd64 [installed]
sensible-utils/stable,now 0.0.17+nmu1 all [installed]
sgml-base/stable,now 1.31 all [installed,automatic]
slirp4netns/stable,now 1.2.0-1 amd64 [installed,automatic]
sudo/stable,now 1.9.13p3-1+deb12u1 amd64 [installed]
systemd-journal-remote/stable,now 252.30-1~deb12u2 amd64 [installed]
systemd-resolved/stable,now 252.30-1~deb12u2 amd64 [installed]
systemd-sysv/stable,now 252.30-1~deb12u2 amd64 [installed]
systemd/stable,now 252.30-1~deb12u2 amd64 [installed]
sysvinit-utils/stable,now 3.06-4 amd64 [installed]
tar/stable,now 1.34+dfsg-1.2+deb12u1 amd64 [installed]
tasksel-data/stable,now 3.73 all [installed]
tasksel/stable,now 3.73 all [installed,automatic]
traceroute/stable,now 1:2.1.2-1 amd64 [installed]
tzdata/stable,now 2024a-0+deb12u1 all [installed]
ucf/stable,now 3.0043+nmu1 all [installed]
udev/stable,now 252.30-1~deb12u2 amd64 [installed]
udisks2/stable,now 2.9.4-4 amd64 [installed]
unattended-upgrades/stable,now 2.9.1+nmu3 all [installed]
usb-modeswitch-data/stable,now 20191128-5 all [installed,automatic]
usb-modeswitch/stable,now 2.6.1-3+b1 amd64 [installed,automatic]
usr-is-merged/stable,now 37~deb12u1 all [installed]
util-linux-extra/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed]
util-linux/stable,stable-security,now 2.38.1-5+deb12u1 amd64 [installed]
vim-common/stable,now 2:9.0.1378-2 all [installed]
vim-tiny/stable,now 2:9.0.1378-2 amd64 [installed]
wamerican/stable,now 2020.12.07-2 all [installed]
wget/stable,now 1.21.3-1+b2 amd64 [installed]
whiptail/stable,now 0.52.23-1+b1 amd64 [installed]
wireless-regdb/stable,now 2022.06.06-1 all [installed,automatic]
wpasupplicant/stable,stable-security,now 2:2.10-12+deb12u2 amd64 [installed,automatic]
xml-core/stable,now 0.18+nmu1 all [installed,automatic]
xz-utils/stable,now 5.4.1-0.2 amd64 [installed]
zlib1g/stable,now 1:1.2.13.dfsg-1 amd64 [installed]
#!/bin/bash
# NOTE: This script has been tested on:
# 4GB RAM, 4vCores
# Linux bookworm 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 GNU/Linux
# Docker Engine: 27.3.1, Docker Buildx: v0.17.1, runc version: v1.1.14-0-g2c9f560, containerd version: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
_SCRIPT_VERSION="0.0.6"
_SCRIPT_NAME="SETUP HAS D12"
######################################
# Configuration
######################################
HA_OS_AGENT_VERSION=1.6.0
LOG_TIMESTAMP=$(date +'%d.%m.%Y-%H:%M:%S')
RESOLVED_DNS_SERVERS="1.1.1.1 8.8.8.8"
RESOLVED_FALLBACK_DNS_SERVERS="1.1.1.1 8.8.8.8 1.0.0.1 8.8.4.4 2606:4700:4700::1111 2001:4860:4860::8888 2606:4700:4700::1001 2001:4860:4860::8844"
set -e
######################################
# Helpers
######################################
function fix_ha_deb_resolved() {
# Define variables
local deb_package
local temp_dir
local postinst_script
deb_package="homeassistant-supervised.deb"
temp_dir=$(mktemp -d)
postinst_script="$temp_dir/DEBIAN/postinst"
# Check if the .deb file exists
if [[ ! -f "$deb_package" ]]; then
echo "Error: $deb_package not found."
return 1
fi
# Check if the required variables are set
if [[ -z "${RESOLVED_DNS_SERVERS}" || -z "${RESOLVED_FALLBACK_DNS_SERVERS}" ]]; then
echo "Error: RESOLVED_DNS_SERVERS or RESOLVED_FALLBACK_DNS_SERVERS is not set."
return 1
fi
# Extract the .deb package to the temp directory
dpkg-deb -R "$deb_package" "$temp_dir"
# Modify the postinst script in the extracted package
if [[ -f "$postinst_script" ]]; then
echo "Updating the postinst script..."
# Insert the DNS update commands before the line with 'while ! ping -c'
sed -i "/while ! ping -c/i \
# Update systemd-resolved DNS settings\n\
if grep -q \"^#DNS=\" /etc/systemd/resolved.conf; then\n\
sed -i \"s/^#DNS=.*/DNS=${RESOLVED_DNS_SERVERS}/\" /etc/systemd/resolved.conf\n\
elif grep -q \"^DNS=\" /etc/systemd/resolved.conf; then\n\
sed -i \"s/^DNS=.*/DNS=${RESOLVED_DNS_SERVERS}/\" /etc/systemd/resolved.conf\n\
else\n\
echo \"DNS=${RESOLVED_DNS_SERVERS}\" >> /etc/systemd/resolved.conf\n\
fi\n\
if grep -q \"^#FallbackDNS=\" /etc/systemd/resolved.conf; then\n\
sed -i \"s/^#FallbackDNS=.*/FallbackDNS=${RESOLVED_FALLBACK_DNS_SERVERS}/\" /etc/systemd/resolved.conf\n\
elif grep -q \"^FallbackDNS=\" /etc/systemd/resolved.conf; then\n\
sed -i \"s/^FallbackDNS=.*/FallbackDNS=${RESOLVED_FALLBACK_DNS_SERVERS}/\" /etc/systemd/resolved.conf\n\
else\n\
echo \"FallbackDNS=${RESOLVED_FALLBACK_DNS_SERVERS}\" >> /etc/systemd/resolved.conf\n\
fi\n\
systemctl restart systemd-resolved\n\
" "$postinst_script"
else
echo "Error: postinst script not found."
return 1
fi
# Rebuild the .deb package with the modified postinst script
dpkg-deb -b "$temp_dir" "fixed_${deb_package}"
# Clean up the temp directory
rm -rf "$temp_dir"
}
######################################
# Main
######################################
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Starting script..."
export DEBIAN_FRONTEND=noninteractive
# Ensure script runs with root privileges
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root"
exit 1
fi
# Sync time
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Syncing time..."
sudo timedatectl set-timezone Europe/Sofia
sudo hwclock --systohc
sudo systemctl restart chrony
sudo chronyc makestep
sleep 5 # :/
# Update system and install packages
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Updating system and installing dependencies for HA..."
apt-get update && apt-get upgrade -y && apt-get autoremove -y
apt-get --fix-broken install -y
apt-get install -y apparmor jq wget curl udisks2 libglib2.0-bin network-manager dbus lsb-release systemd-journal-remote systemd-resolved inotify-tools
# Enable and start systemd-resolved service
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Enabling and starting systemd-resolved service..."
systemctl enable systemd-resolved.service
systemctl start systemd-resolved.service
# Force symlink to correct systemd-resolved config
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Forcing symlink to correct systemd-resolved config..."
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
# Configure systemd-resolved
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Configuring systemd-resolved servers..."
tee /etc/systemd/resolved.conf <<EOF
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details
[Resolve]
DNS=${RESOLVED_DNS_SERVERS}
FallbackDNS=${RESOLVED_FALLBACK_DNS_SERVERS}
#Domains=
DNSSEC=no
DNSOverTLS=no
#MulticastDNS=yes
#LLMNR=yes
#Cache=yes
DNSStubListener=no
#ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no
EOF
# Restart systemd-resolved and NetworkManager to apply DNS settings
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Restarting systemd-resolved and NetworkManager to apply DNS settings..."
systemctl restart systemd-resolved
systemctl restart NetworkManager
# Flush DNS cache and check network
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Flushing DNS cache..."
resolvectl flush-caches
# Install Docker
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Installing Docker..."
curl -fsSL https://get.docker.com -o get-docker.sh
bash get-docker.sh && rm -f get-docker.sh
# Install Home Assistant OS Agent
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Installing Home Assistant OS Agent..."
wget https://github.com/home-assistant/os-agent/releases/download/${HA_OS_AGENT_VERSION}/os-agent_${HA_OS_AGENT_VERSION}_linux_x86_64.deb
dpkg -i os-agent_${HA_OS_AGENT_VERSION}_linux_x86_64.deb && rm -f os-agent_${HA_OS_AGENT_VERSION}_linux_x86_64.deb
# Install Home Assistant Supervised
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Installing Home Assistant Supervised..."
wget https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
fix_ha_deb_resolved
apt-get install -y ./fixed_homeassistant-supervised.deb && rm -f homeassistant-supervised.deb fixed_homeassistant-supervised.deb
# Print connectors
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Connect to Home Assistant at the following addresses:"
echo "http://$(hostname -I | cut -d' ' -f1):8123"
echo "http://$(hostname -I | cut -d' ' -f2):8123"
# Reboot system
echo "[${_SCRIPT_NAME} v${_SCRIPT_VERSION}][$LOG_TIMESTAMP]: Rebooting system..."
sudo reboot now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment