Home Assistant can be installed in a few ways. This covers the installation of HA Core which is a more limited version of HA Supervised.
Start with Debian 12 base image:
sudo eatmydata apt-get install -y python3 python3-dev python3-venv python3-pip python3-numpy bluez libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff6 libturbojpeg0-dev tzdata ffmpeg liblapack3 liblapack-dev libatlas-base-dev
sudo adduser --system --group --home /srv/ha ha
hostname -I # Remember or copy your IP
sudo su -s /bin/bash ha
cd ~
python3 -m venv .
source bin/activate
python3 -m pip install wheel
pip3 install homeassistant
hass
After this is complete, go to the IP from the hostname -I
command above in your browser and append :8123
to the end of the URL. The web page will guide you through the rest of the setup process.
After the basic setup is complete, it will show a loading window for 5-15 minutes or so as Home Assistant compiles a few packages. It takes this long since the code is serially compiling files instead of using all cores to compile.
Once the setup is completed and you are able to log into the dashboard, click Developer Tools → RESTART. This should cause the running hass process to terminate.
Create the following file /etc/systemd/system/home-assistant@ha.service
with the content:
[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
User=%i
WorkingDirectory=/srv/%i/.homeassistant
ExecStart=/srv/ha/bin/hass -c "/srv/%i/.homeassistant"
RestartForceExitStatus=100
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
Then enable the service:
sudo systemctl --system daemon-reload
sudo systemctl enable home-assistant@ha
sudo systemctl start home-assistant@ha
To get the logs of the service:
sudo journalctl -u home-assistant@ha --no-pager