20200223更新:
最近安装了Ubuntu 18.04.4,教程与原来没多大区别,主要是源地址变了,最后安装时也有点变动,其他与原教程一致。
#必选项!更换国内源(这次是163的)!如果不更换,sudo apt-get update会非常慢
#首先是备份原源地址,然后将虚线间的代码加入sources.list,contrl + x, y 退出
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo nano /etc/apt/sources.list
----------------------------------------------------------------------------------------------------
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
----------------------------------------------------------------------------------------------------
#安装hass.io
sudo apt-get install -y apparmor-utils apt-transport-https avahi-daemon jq socat network-manager
sudo systemctl disable ModemManager
sudo apt-get purge modemmanager
curl -sL "https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh" | sudo bash -s
========================以下是原教程========================
无坑系列教程再度走起!
看教程前,默认你已经通过虚拟机或是实体安装了Ubuntu 17.10 server版。
#首先改一下sudoer设置,省得sudo时总要求输密码
sudo nano /etc/sudoers
#在最下面(看好,是此文件的最下方,否则会被下面的设置所覆盖而无效!)添加以下内容(jones改为你的用户名):
jones ALL=NOPASSWD: ALL
#可选项,如果在安装ubuntu时没有更改时区的,使用下面的代码更改时区
sudo dpkg-reconfigure tzdata
#必选项!更换国内源(这次是163的)!如果不更换,sudo apt-get update会非常慢
#首先是备份原源地址,然后将虚线间的代码加入sources.list,contrl + x, y 退出
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo nano /etc/apt/sources.list
----------------------------------------------------------------------------------------------------
deb http://mirrors.163.com/ubuntu/ artful main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ artful-backports main restricted universe multiverse
----------------------------------------------------------------------------------------------------
#更新源信息,安装更新
sudo apt-get update && sudo apt-get upgrade -y
#做一些清理工作
sudo apt-get autoclean
sudo apt-get clean
####安装docker-ce####
#首先添加gpg密钥
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
#添加软件源,运行第一行命令,将第二行添加到文件末尾,ctrl + x,y保存退出
sudo nano /etc/apt/sources.list.d/docker.list
deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu artful edge
#正式安装docker-ce
sudo apt-get update
sudo apt-get install docker-ce
#将当前用户加入docker用户组,避免使用root用户运行
sudo usermod -aG docker $USER
#注册并应用加速器https://cr.console.aliyun.com/#/accelerator
----------------------------------------------------------------------------------------------------
#加速器添加方法一,记得把xxxxx那些替换为你自己注册得到的加速器地址
sudo nano /etc/systemd/system/multi-user.target.wants/docker.service
#找到以下行,把加速器地址粘在后面
ExecStart=/usr/bin/dockerd --registry-mirror=https://xxxxxxxxx.mirror.aliyuncs.com
#加速器添加方法二
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxxxxxxx.mirror.aliyuncs.com"]
}
EOF
----------------------------------------------------------------------------------------------------
#重载systemctl,重启docker
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl enable docker
#重启系统
sudo reboot
#安装hass.io,安装需要一些时间,等大概10几分钟后,尝试打开ip:8123,如果出现HASS界面,表示安装成功。
sudo apt-get install -y socat jq avahi-daemon
curl -sL https://raw.githubusercontent.com/home-assistant/hassio-build/master/install/hassio_install | sudo bash -
|