-
-
Save bezda/1cd18c2d75d990afabe27a93cf72a126 to your computer and use it in GitHub Desktop.
Supervised Home Assistant on Turris Omnia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit to: | |
# - e-minguez for https://gist.github.com/e-minguez/0e74044a32a6870ebebf044a1ad487e2 | |
# - home-assistant supervised installation documentation at https://github.com/home-assistant/supervised-installer | |
# - home-assistant os-agent installation documentation at https://github.com/home-assistant/os-agent/tree/main#using-home-assistant-supervised-on-debian | |
HOSTNAME=homeassistant | |
CONTAINER_HOME=/srv/lxc/${HOSTNAME} | |
opkg install kmod-veth | |
opkg install kmod-ipt-extra | |
opkg install iptables-mod-extra | |
opkg install ip6tables-mod-nat | |
lxc-create -n ${HOSTNAME} -t download -- --dist Debian --release Bullseye --arch armv7l --server repo.turris.cz/lxc | |
# Set container hostname | |
echo ${HOSTNAME} > ${CONTAINER_HOME}/rootfs/etc/hostname | |
sed -i "s/LXC_NAME/${HOSTNAME}/g" ${CONTAINER_HOME}/rootfs/etc/hosts | |
# Open up access to the host, allowing docker to successfully start | |
sed -i 's/#lxc.include/lxc.include/g' ${CONTAINER_HOME}/config | |
cat <<EOF >> ${CONTAINER_HOME}/config | |
# The following lines open up access to the host, allowing docker to successfully start | |
raw.lxc: |- | |
lxc.mount.auto = proc:rw | |
lxc.cgroup2.devices.allow = a | |
security.nesting: "true" | |
security.privileged: "true" | |
lxc.cap.drop = | |
EOF | |
lxc-start ${HOSTNAME} | |
lxc-attach ${HOSTNAME} | |
# the rest of commands are executed inside container | |
apt-get install iptables kmod | |
update-alternatives --set iptables /usr/sbin/iptables-legacy | |
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy | |
# If you choose to install official Debian docker package, you will need to | |
# manually alter homeassistant-supervised dpkg status | |
apt-get install docker.io | |
# If you'd like to install docker from official sources, run these two commands instead | |
#curl -fsSL https://get.docker.com -o get-docker.sh | |
#sh get-docker.sh | |
# install home assistant | |
apt-get install \ | |
apparmor \ | |
jq \ | |
wget \ | |
curl \ | |
udisks2 \ | |
libglib2.0-bin \ | |
network-manager \ | |
dbus \ | |
lsb-release \ | |
systemd-journal-remote -y | |
# Download the latest Debian package of os-agent at https://github.com/home-assistant/os-agent/releases/latest | |
wget -c https://github.com/home-assistant/os-agent/releases/download/1.4.1/os-agent_1.4.1_linux_armv7.deb | |
dpkg -i os-agent_1.4.1_linux_armv7.deb | |
# To verify successful installation, this command should not return an error | |
gdbus introspect --system --dest io.hass.os --object-path /io/hass/os | |
# Install the Home Assistant Supervised Debian Package | |
wget https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb | |
# The --ignore-depends=docker-ce is only necessary if you've installed official Debian Docker package | |
dpkg --ignore-depends=docker-ce -i homeassistant-supervised.deb | |
# when asked for a CPU architecture, select qemuarm | |
# This step is only necessary if you've installed official Debian Docker package | |
sed -i 's/Depends: curl, bash, docker-ce, dbus, network-manager, apparmor, jq, systemd, os-agent, systemd-journal-remote/Depends: curl, bash, docker.io, dbus, network-manager, apparmor, jq, systemd, os-agent, systemd-journal-remote/g' /var/lib/dpkg/status | |
# After installing homeassistant-supervised package, you should following message, | |
# which means homeassistant was successfully downloaded and is now fetching HA docker images. | |
#[info] Within a few minutes you will be able to reach Home Assistant at: | |
#[info] http://homeassistant.local:8123 or using the IP address of your | |
#[info] machine: http://192.168.1.2:8123 | |
# You can keep running following command and wait for docker container named homeassistant to appear. | |
# You can then visit the above URL to access Home Assistant UI, which will guide you to next steps in setting up HA. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment