This is copied from https://www.home-assistant.io/installation/linux#install-dependencies and stored for historical purposes.
Before you start, make sure your system is fully updated, all packages in this guide are installed with apt, if your OS does not have that, look for alternatives.
sudo apt-get update
sudo apt-get upgrade -y
Install the dependencies:
sudo apt-get install -y python3 python3-dev python3-venv python3-pip bluez libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata ffmpeg liblapack3 liblapack-dev libatlas-base-dev
The above-listed dependencies might differ or missing, depending on your system or personal use of Home Assistant.
Add an account for Home Assistant Core called homeassistant. Since this account is only for running Home Assistant Core the extra arguments of -rm is added to create a system account and create a home directory.
sudo useradd -rm homeassistant
First we will create a directory for the installation of Home Assistant Core and change the owner to the homeassistant account.
sudo mkdir /srv/homeassistant
sudo chown homeassistant:homeassistant /srv/homeassistant
Next up is to create and change to a virtual environment for Home Assistant Core. This will be done as the homeassistant account.
sudo -u homeassistant -H -s
cd /srv/homeassistant
python3 -m venv .
source bin/activate
Once you have activated the virtual environment (notice the prompt change to (homeassistant) homeassistant@raspberrypi:/srv/homeassistant $
) you will need to run the following command to install a required Python package.
python3 -m pip install wheel
Once you have installed the required Python package, it is now time to install Home Assistant Core!
pip3 install homeassistant==2023.1.7
Now install the systemd
unit to allow the systemd
to manage running the process
sudo nano -w /etc/systemd/system/[email protected]
[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/%i/.homeassistant"
[Install]
WantedBy=multi-user.target
Enable and start the homeassistant unit, this may take a bit of time the first time you do this.
sudo systemctl --system daemon-reload
sudo systemctl enable home-assistant@homeassistant
sudo systemctl start home-assistant@homeassistant
Debug the startup of Hass, now go to http://IP_ADDRESS:8123
sudo journalctl -f -u home-assistant@homeassistant
To assume into homeassistant user
sudo -u homeassistant -H -s
You need node installed
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
export NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install nodejs -y
After getting node install you can then do a global install of @zwave-js/server
npm config set prefix /home/homeassistant
npm i -g @zwave-js/server
Include (or check if) $HOME/bin/
is included in $PATH
nano .profile
...
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
...
Check if by running. My serial zwave dongle is located as at the first argument.
~/bin/zwave-server /dev/serial/by-id/usb-0658_0200_01FFFFFF-FFFF-FFFF-FFFF-140517084952-if00
Kill this process.
Now install the systemd
unit to allow the systemd
to manage running the process
sudo nano -w /etc/systemd/system/[email protected]
[Unit]
Description=ZWave JS Server
After=network-online.target
[Service]
Type=simple
User=%i
ExecStart=/home/homeassistant/bin/zwave-server /dev/serial/by-id/usb-0658_0200_01FFFFFF-FFFF-FFFF-FFFF-140517084952-if00
[Install]
WantedBy=multi-user.target
Enable and start the zwave-js-server unit, this may take a bit of time the first time you do this.
sudo systemctl --system daemon-reload
sudo systemctl enable zwave-js-server@homeassistant
sudo systemctl start zwave-js-server@homeassistant
To debug
sudo journalctl -f -u zwave-js-server@homeassistant