知乎专栏 |
Home Assistant 建议安装在 Debian 系的 Linux 中
安装 Docker
mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null apt update -y apt install -y curl gnupg2 apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
安装依赖包
apt update apt install udisks2
Agent for Home Assistant OS
wget https://github.com/home-assistant/os-agent/releases/latest/download/os-agent_1.5.1_linux_x86_64.deb apt install ./os-agent_1.5.1_linux_x86_64.deb systemctl status haos-agent https://github.com/home-assistant/os-agent/releases/tag/1.5.1
wget https://github.com/home-assistant/supervised-installer/releases/download/1.4.3/homeassistant-supervised.deb dpkg -i homeassistant-supervised.deb wget https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb apt install ./homeassistant-supervised.deb
sudo docker run --restart always -d --name homeassistant \ -v /PATH_TO_YOUR_CONFIG:/config \ --device=/PATH_TO_YOUR_USB_STICK \ -e TZ=Australia/Melbourne --net=host \ ghcr.io/home-assistant/home-assistant:stable sudo dpkg -i https://github.com/home-assistant/supervised-installer/releases/download/1.4.3/homeassistant-supervised.deb sudo docker run --restart always -d --name homeassistant \ --restart=unless-stopped \ -v /srv/homeassistant:/config \ -p 8123:8123 -p 4357:4357 \ -e TZ=Asia/Shanghai --net=host \ ghcr.io/home-assistant/home-assistant:stable
重启 debian
reboot
version: '3' services: homeassistant: container_name: homeassistant image: "ghcr.io/home-assistant/home-assistant:stable" volumes: - /PATH_TO_YOUR_CONFIG:/config - /etc/localtime:/etc/localtime:ro restart: unless-stopped privileged: true network_mode: host
wget https://github.com/home-assistant/os-agent/releases/latest/download/os-agent.deb apt install ./homeassistant-supervised.deb wget https://github.com/home-assistant/os-agent/releases/latest/download/os-agent_1.5.1_linux_x86_64.deb apt install ./os-agent_1.5.1_linux_x86_64.deb curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" apt install docker-ce wget https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb apt install ./homeassistant-supervised.deb
root@homeassistant:~# apt list --installed | grep homeassistant-supervised WARNING: apt does not have a stable CLI interface. Use with caution in scripts. homeassistant-supervised/now 1.4.2 all [installed,local]
前往 https://github.com/home-assistant/supervised-installer/releases 找到需要升级的版本
root@homeassistant:~# wget https://github.com/home-assistant/supervised-installer/releases/download/1.5.0/homeassistant-supervised.deb
使用下面命令更新
dpkg -i --ignore-depends=systemd-resolved ./homeassistant-supervised.deb
更新过程演示
root@homeassistant:~# dpkg -i --ignore-depends=systemd-resolved ./homeassistant-supervised.deb (Reading database ... 35672 files and directories currently installed.) Preparing to unpack ./homeassistant-supervised.deb ... [warn] [warn] If you want more control over your own system, run [warn] Home Assistant as a VM or run Home Assistant Core [warn] via a Docker container. [warn] Leaving 'diversion of /etc/NetworkManager/NetworkManager.conf to /etc/NetworkManager/NetworkManager.conf.real by homeassistant-supervised' Leaving 'diversion of /etc/NetworkManager/system-connections/default to /etc/NetworkManager/system-connections/default.real by homeassistant-supervised' Leaving 'diversion of /etc/docker/daemon.json to /etc/docker/daemon.json.real by homeassistant-supervised' Leaving 'diversion of /etc/network/interfaces to /etc/network/interfaces.real by homeassistant-supervised' Unpacking homeassistant-supervised (1.5.0) over (1.4.2) ... Setting up homeassistant-supervised (1.5.0) ... [info] Restarting NetworkManager [info] Restarting docker service PING checkonline.home-assistant.io (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.391 ms --- checkonline.home-assistant.io ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.391/0.391/0.391/0.000 ms [info] Install supervisor startup scripts [info] Install AppArmor scripts [info] Start Home Assistant Supervised [info] Installing the 'ha' cli [warn] Could not find /etc/default/grub or /boot/firmware/cmdline.txt failed to switch to cgroup v1 [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://10.10.0.10:8123