Установка HomeAssistant на PC Ubuntu 22.04
Install Home Assistant Core on Ubuntu 22.04
-
apt update && apt upgrade
optionally to make sure all packages are installed correctly:- dpkg --configure -a
- apt install -f
- apt-get --fix-broken install
- apt-get update --fix-missing
- apt update && apt upgrade
-
add-apt-repository ppa:deadsnakes/ppa
-
apt update
-
apt install wget build-essential libncursesw5-dev libssl-dev
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev -
apt install python3.11 python3.11-dev python3.11-venv python3-pip
-
Change the first line in files “/usr/bin/pip” & “/usr/bin/pip3” to “#!/usr/bin/python3.11”
-
apt install 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
-
useradd -rm homeassistant -G dialout
-
mkdir /srv/homeassistant
-
chown homeassistant:homeassistant /srv/homeassistant
-
sudo -u homeassistant -H -s
-
cd /srv/homeassistant
-
python3.11 -m venv .
-
source bin/activate
-
python3.11 -m pip install wheel
-
pip3 install homeassistant==2023.8.3
-
hass
-
Create file (init.d script) “/etc/init.d/homeassistant”
#!/bin/sh
# For Ubuntu:
# description: Home Assistant
# processname: hass
### BEGIN INIT INFO
# Provides: hass
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Home Assistant service
# Description: Home Assistant
### END INIT INFO
name="HomeAssistant"
pid_file="/var/run/$name.pid"
case "$1" in
start)
su - homeassistant -c '/srv/homeassistant/bin/python3.11 /srv/homeassistant/bin/hass' &>/dev/null &
echo $(pgrep python3.11) > "$pid_file"
echo "Running with PID: $(pgrep python3.11)"
;;
stop)
echo -n "Stopping $name.."
kill $(pgrep python3.11)
rm "/var/run/$name.pid"
;;
restart)
stop
start
;;
status)
if $(pgrep hass); then
echo "Running with PID: $(pgrep python3.11)"
else
echo "$name is not running"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
-
chmod 0755 /etc/init.d/homeassistant
-
update-rc.d homeassistant defaults
-
reboot
-
Check if Home Assistant is running:
service homeassistant status -
Done
-
Go to “http:// « ip address » :8123”
-
Close the session to end root access
Взято тут
Автор: igel