请选择 进入手机版 | 继续访问电脑版

『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 10628|回复: 13

[基础教程] debian10 安装 Home Assistant Supervised

[复制链接]

3

主题

23

帖子

496

积分

论坛分享达人

积分
496
金钱
473
HASS币
0
发表于 2021-4-19 11:07:54 | 显示全部楼层 |阅读模式
本帖最后由 OoUuBo 于 2021-4-19 16:30 编辑

硬件:二手星际蜗牛 cpu-J1900 4G内存 64G固态
系统:debian10
参考文档:https://community.home-assistant.io/t/installing-home-assistant-supervised-on-debian-10/200253

一、安装debian10 操作系统
1.下载 debian-live-10.7.0-amd64-standard.iso 。
  地址:https://cdimage.debian.org/debian-cd/current-live/amd64/bt-hybrid/
  注:版本号我下载的时候已经是10.9.0 ,没关系,下载对应standard版本就行。
2.制作u盘安装盘。
下载制作软件 Rufus ,自行百度下载吧,不难找。
打开后如图设置,勾选显示usb外置硬盘,设备选择插入的u盘,引导类型选择第一步下载的 iso安装文件,点击开始,等待完成。
1618799334(1).png

3.安装debian10系统
取下制作好的u盘,插到要安装系统的设备上(先要bios设置u盘启动),开机。
按流畅下一步,就行。注意下语言选择英文(开始选的中文,命令行会乱码,又改成英文了)。
具体安装如果不明白的参考,参考文档中有详细说明。我复制过来了,和实际顺序有点小区别,影响不大。
1.5) The first screen you should be able to select from is Main Menu, on this screen, select Graphical Debian Installer
1.6) Next will be Language. Choose your language and click continue.
1.7) Next will be Select your location. Choose your country and click continue.
1.8) Next will be Configure the keyboard. Select your keyboard type and click continue. The installer will now perform some automated tasks which will take 1-2 minutes.
1.9) Next will be Configure the network. Here you can name your machine, the default name will be debian. Choose a name and click continue. You can skip the next page by clicking continue as you do not need to set a domain name.
1.10) Next will be Set up users and passwords. You will be asked to create a password for the root user. Make a note of the password you choose here, and click continue.
1.11) Next will be Set up users and passwords again. Enter a username, click continue and on the next screen, enter a password for this user account. Make note of both of these, you will need them later.
1.12) Next will be Configure the clock. Select the correct time zone and click continue.
1.13) Next will be Partition Disks. Select Guided - use entire disk and then click continue. On the next screen make sure the correct disk is selected and click continue. On the next screen select All files in one partition and click continue. On the next screen, make sure Finish partitioning and write changes to disk is selected, and click continue. On the next screen, select Yes and then click continue. The installer will now perform some automated tasks. This will take 1-2 mins.
1.14) Next will be Configure the package manager. Select Yes and click continue. Select your Country and click continue. You can leave the default selection deb.debian.org 25 selected, or select another mirror of your choosing, and click continue. Leave the next page blank and click continue. The installer will now perform some automated tasks. This will take a few minutes.
1.15) Next will be Install the GRUB bootloader. Select Yes and click continue. Now select the drive you are installing Debian on, and click continue. The installer will now perform some automated tasks. This will take 1-2 mins and then installation will be complete.

到这边debian10就安装好了,我安装时候好像没有自动重启,于是手动重启,系统就打开了。

4.安装完成做几个简单配置

  • 命令行输入

usermod -aG sudo username


usernameStep 1.11 中设置的用户名,不是root。
  • ctrl-d 退出root账户,用步骤1.11的用户名重新登录。
  • 在安装Home Assistant Supervised之前,用下面的命令更新下操作系统。

sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y



二、安装 Home Assistant Supervised
1.首先要配置下host文件,手动域名解析,不然下面第二步的最后一行命令,不会有反应。
通过这个下面网址解析https://raw.githubusercontent.com的真实ip,我解析出来用的 185.199.108.133
https://githubusercontent.com.ipaddress.com/raw.githubusercontent.com        
用下面的命令打开host文件,打开后的怎么编辑 ,可以百度vim编辑器操作方法。我分享一个说明链接 https://ipcmen.com/vi-vim
sudo vi /etc/hosts

添加一行,内容如下   
185.199.108.133  raw.githubusercontent.com
退出,并保存。

2.依次执行以下命令,一次一行。
sudo -i
apt-get install -y software-properties-common apparmor-utils apt-transport-https ca-certificates curl dbus jq network-manager
systemctl disable ModemManager
systemctl stop ModemManager
curl -fsSL get.docker.com | sh
curl -sL "https://raw.githubusercontent.com/Kanga-Who/home-assistant/master/supervised-installer.sh" | bash -s


3.等到命令行出现 安装完成提示和访问地址,就安装成功了。

三、静态IP设置(不设置,关机再访问,ip地址可能就变了)
1、先查看本机当前的IP地址,命令
ip address


找到信息如下:enp3s0是网卡名字,这个记住,每个设备不一样,后面要用到,下面的inet 192.168.2.171/24就是本机当前的ip地址,默认这个是路由器随机分配的。
D:\youdaonote\qq1AEC99C6E7DF0C55BD006E44D4071E1C\d12d3606da304ac780326974396ae320\1618820017.png

1618820017.png
2、用vim编辑器修改下面文档
sudo vi /etc/network/interfaces


内容修改如下(或者直接覆盖原来文档内容):
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp3s0
# iface enp3s0inet dhcp
auto enp3s0
iface enp3s0inet static
address 192.168.2.171
netmask 255.255.255.0
gateway 192.168.2.1

D:\youdaonote\qq1AEC99C6E7DF0C55BD006E44D4071E1C\1ce5c9cfcb0c4da18028235b10253cbe\1618820224(1).png

1618820224(1).png
3、reboot重启即可(shutdown now直接关机)。
reboot


不知道为什么,我的系统用命令始终关不掉。(反正等了挺久的,也关不掉)必须强制关机或重启。



评分

参与人数 2金钱 +40 收起 理由
+ 20 感谢楼主分享!
neroxps + 20 感谢楼主分享!

查看全部评分

回复

使用道具 举报

40

主题

3057

帖子

1万

积分

超级版主

Nero

Rank: 8Rank: 8

积分
11135
金钱
8028
HASS币
182
发表于 2021-4-19 11:16:55 | 显示全部楼层
本帖最后由 neroxps 于 2021-4-19 11:19 编辑

但是只修改宿主的 hosts 的没用的~等 supervisor 起来后,唤起 hassio-dns 默认所有 hassio 的dns 解析都从 hassio-dns 那边来~上游是 tls://1.1.1.1
虽然你可以手动写hosts 到 hassio-dns 的配置文件里面~方法在此~ https://github.com/neroxps/hassi ... nstall.sh#L404-L417

但是 hassio-dns 不会持久化 hosts 文件~所以重启后, hosts 就会恢复原样~
Nero
回复

使用道具 举报

3

主题

23

帖子

496

积分

论坛分享达人

积分
496
金钱
473
HASS币
0
 楼主| 发表于 2021-4-19 11:57:25 | 显示全部楼层
neroxps 发表于 2021-4-19 11:16
但是只修改宿主的 hosts 的没用的~等 supervisor 起来后,唤起 hassio-dns 默认所有 hassio 的dns 解析都从  ...

大佬,能具体说说host文件恢复原样,有什么影响吗?  我也是刚装上系统 记录一下过程。   你说的这个是重启后会影响supervisor 里面插件的加载吗?  对系统运行有没有影响?
回复

使用道具 举报

40

主题

3057

帖子

1万

积分

超级版主

Nero

Rank: 8Rank: 8

积分
11135
金钱
8028
HASS币
182
发表于 2021-4-19 12:04:05 | 显示全部楼层
本帖最后由 neroxps 于 2021-4-19 12:08 编辑
OoUuBo 发表于 2021-4-19 11:57
大佬,能具体说说host文件恢复原样,有什么影响吗?  我也是刚装上系统 记录一下过程。   你说的这个是重 ...

对于 homeassistant 是没有影响的,影响主要是 addons 的源加载~

还有 addons pull 时候会很慢(对官方 addons 而言),国际精品网除外哈
但是如果只用 homeassistant 的话,为何不直接用 docker 装homeassistant?

https://www.home-assistant.io/in ... assistant-container
Nero
回复

使用道具 举报

3

主题

23

帖子

496

积分

论坛分享达人

积分
496
金钱
473
HASS币
0
 楼主| 发表于 2021-4-19 12:21:47 | 显示全部楼层
neroxps 发表于 2021-4-19 12:04
对于 homeassistant 是没有影响的,影响主要是 addons 的源加载~

还有 addons pull 时候会很慢(对官方 add ...

装的时候没考虑。不过这个addons  应该还是要用的。早知道有一键脚本,就不这么费神了。   那这个脚本中改host 是每次开机都自动运行一次?  还是改一次就行。
回复

使用道具 举报

3

主题

23

帖子

496

积分

论坛分享达人

积分
496
金钱
473
HASS币
0
 楼主| 发表于 2021-4-19 12:25:52 | 显示全部楼层
neroxps 发表于 2021-4-19 12:04
对于 homeassistant 是没有影响的,影响主要是 addons 的源加载~

还有 addons pull 时候会很慢(对官方 add ...
更新 github hosts 文件到 coreDNS 的 hosts 文件里加速 addons clone 速度
## hosts 文件来自 github.com/jianboy/github-host 项目
github_set_hosts_to_coreDNS()
是不是按这个方法。手动把host 添加下就行了。我看程序好像就执行了一次这个方法。
回复

使用道具 举报

40

主题

3057

帖子

1万

积分

超级版主

Nero

Rank: 8Rank: 8

积分
11135
金钱
8028
HASS币
182
发表于 2021-4-19 12:38:33 | 显示全部楼层
OoUuBo 发表于 2021-4-19 12:25
是不是按这个方法。手动把host 添加下就行了。我看程序好像就执行了一次这个方法。 ...

没用的 hassio_dns 重启之后hosts 文件就又恢复原来的

所以最好方法是路由上写 hosts ,然后 ha dns option --servers "dns://你路由的IP地址"

让 hassio_dns 上游DNS 是你路由器才行~

不过我脚本没法帮助你写入路由 hosts 所以我也懒得搞了~直接劝退
Nero
回复

使用道具 举报

40

主题

3057

帖子

1万

积分

超级版主

Nero

Rank: 8Rank: 8

积分
11135
金钱
8028
HASS币
182
发表于 2021-4-19 12:41:48 | 显示全部楼层
OoUuBo 发表于 2021-4-19 12:21
装的时候没考虑。不过这个addons  应该还是要用的。早知道有一键脚本,就不这么费神了。   那这个脚本中 ...

emmm 我脚本现在要必须能出国旅游才给用了~我已经没有办法修~hassio 必须能上 github 否则没啥好玩的~
Nero
回复

使用道具 举报

4

主题

54

帖子

261

积分

中级会员

Rank: 3Rank: 3

积分
261
金钱
207
HASS币
0
发表于 2021-4-19 13:18:39 | 显示全部楼层
本帖最后由 NGDD 于 2021-4-19 13:29 编辑
neroxps 发表于 2021-4-19 12:41
emmm 我脚本现在要必须能出国旅游才给用了~我已经没有办法修~hassio 必须能上 github 否则没啥好玩的~ ...

现在上GitHub根本不需要旅游就能随便上,而你的脚本又必须要能旅游才给安装,好郁闷。大神能否出个编译的虚拟机版,和官方的虚拟机版一样可靠。

评分

参与人数 1金钱 +5 收起 理由
793919425 + 5 论坛有你更精彩!

查看全部评分

回复

使用道具 举报

3

主题

23

帖子

496

积分

论坛分享达人

积分
496
金钱
473
HASS币
0
 楼主| 发表于 2021-4-19 13:31:51 | 显示全部楼层
neroxps 发表于 2021-4-19 12:41
emmm 我脚本现在要必须能出国旅游才给用了~我已经没有办法修~hassio 必须能上 github 否则没啥好玩的~ ...

好的,感谢大神。   不行我就每次重启加载的时候改下host。应该也就是下载的时候需要吧,正常使用的时候连不上没关系吧
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-3-28 16:20 , Processed in 0.100752 second(s), 35 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表