说明:
1:此文转载,侵删]参考/thread-3501-1-1.html
2:修改echo "`date +%H:%M:%S`>>>>>>>>>>使用root用户安装 Hass.io<<<<<<<<<<"安装源地址
3:本人安装配置:树莓派3B+raspbian stretch Lite +docker+hassio
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1:raspbian官网下载系统,本次安装为stretch lite版本.
2:用Etcher烧炉系统,烧炉结束在根目录新建ssh文件,开启ssh功能;新增wpa_supplicant.conf文件,写入内容:
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="wifi-name"
psk="wifi-key"
key_mgmt=WPA-PSK
priority=1
}
3,用ipscaner找打树莓派的ip地址,用putty工具SSH到你的raspbian系统,用户名是pi,密码是raspberry。
首先要把系统读写区域扩大到整个内存卡
sudo raspi-config
然后选择第7项 advanced settings高级设置 的第1项回车,确定。
重启树莓派系统sudo reboot
重新ssh连接.
cd /tmp
进入缓存目录
sudo nano docker_hassio.sh
创建一个临时shell文件
复制以下内容,粘贴到putty,
#!/bin/bash#首先,运行以下命令,将SD卡扩大到整个空间,然后重启树莓派#sudo raspi-config#选7 ---->选1#设置中文语言 选4 ---->选1 拉到最后选Zh-cn的GBK UTF-8等#设置时区选4 ---->选2 选 Asia ----Shanghai#设置wifi地区 选4 ---->选4 选 CN china#sudo reboot#重启之后,依次运行以下命令#cd /tmp#sudo nano docker_hassio.sh#复制本文件内容,到ssh命令行中,保存,关闭,然后依次运行下面的命令#sudo chmod u+x docker_hassio.shnetwork#sudo ./docker_hassio.sh 1>&2echoecho "`date +%H:%M:%S`<<<<<<<<<<<<一键安装脚本开始执行>>>>>>>>>>>>>"echoecho "<<<<<<<<<<<<修改源地址>>>>>>>>>>>>>"sudo tee /etc/apt/sources.list <<-'EOF'#deb /raspbian/raspbian/ stretch main contrib non-free rpi#deb-src /raspbian/raspbian/ stretch main contrib non-free rpideb http://mirrors./raspbian/raspbian/ stretch main contrib non-free rpideb-src http://mirrors./raspbian/raspbian/ stretch main contrib non-free rpi#deb https://mirrors.tuna./raspberrypi/ stretch main contrib non-free rpi#deb-src https://mirrors.tuna./raspberrypi/ stretch main contrib non-free rpiEOFsudo tee /etc/apt/sources.list.d/raspi.list <<-'EOF'#deb https://mirrors.tuna./raspberrypi/ stretch uideb http://mirrors./raspbian/raspbian/ stretch ui#deb /debian/ stretch uiEOFecho# echo "`date +%H:%M:%S`<<<<<<<<<<<<配置中文字符集>>>>>>>>>>>>>"# sudo tee /etc/locale.gen <<-'EOF'# zh_CN.GB2312# zh_CN.GBK GBK# zh_CN.UTF-8 UTF-8# EOF# sudo locale-gen# echoecho "`date +%H:%M:%S`>>>>>>>>>>添加HTTPS传输软件包以及CA证书<<<<<<<<<<"sudo apt-get install -y \apt-transport-https \ca-certificates \curl \gnupg2 \software-properties-commonechoecho "`date +%H:%M:%S`>>>>>>>>>>添加Docker 官方GPG密钥<<<<<<<<<<"curl -fsSL /linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -sleep 1echoecho "`date +%H:%M:%S`>>>>>>>>>>添加 Docker CE 软件源<<<<<<<<<<"echo "deb [arch=armhf] /linux/debian \$(lsb_release -cs) stable" | \sudo tee /etc/apt/sources.list.d/docker.listsleep 1echoecho "`date +%H:%M:%S`>>>>>>>>>>更新 apt 软件包缓存并安装Docker CE<<<<<<<<<<"sudo apt-get update && apt-get upgrade -y sudo apt-get install docker-ce -yechoecho "`date +%H:%M:%S`>>>>>>>>>>将当前用户添加到 Docker 组<<<<<<<<<<"#sudo groupadd dockersudo usermod -aG docker $USERechoecho "`date +%H:%M:%S`>>>>>>>>>>修改Docker仓库到国内加速器<<<<<<<<<<"#sudo mkdir -p /etc/dockersudo tee /etc/docker/daemon.json <<-'EOF'{"registry-mirrors": ["https://registry.docker-"]}EOFsleep 2echoecho "`date +%H:%M:%S`>>>>>>>>>>重新加载Docker配置并重启<<<<<<<<<<"sudo systemctl daemon-reloadsudo systemctl restart dockersleep 3cd ~mkdir .pipsudo tee ~/.pip/pip.conf <<-'EOF'[global]trusted-host=index-url=/pypi/simpleEOFsleep 3echo "`date +%H:%M:%S`>>>>>>>>>>获取最新源列表并更新软件<<<<<<<<<<"sudo apt-get update && apt-get upgrade -ysudo apt-get dist-upgrade -yechoecho "`date +%H:%M:%S`>>>>>>>>>>安装bash socat jq支持库软件<<<<<<<<<<"sudo apt-get install -y bash jq curl avahi-daemon dbus apparmor-utils network-managerechoecho "`date +%H:%M:%S`>>>>>>>>>>安装Samba Git Screen Net-tools Nmap工具软件,配置Samba共享目录<<<<<<<<<<"sudo apt-get install -y samba screen git net-tools nmapecho "[global]netbios name = Raspberry Piserver string = The Pi File Centerworkgroup = WORKGROUPhosts allow =remote announce =remote browse sync =create mask = 0777directory mask = 0777force user = rootforce create mode = 0777force directory mode = 0777hosts allow = [Home Assistant] path = /usr/share/hassiocomment = No commentbrowsable = yesread only = novalid users =writable = yesguest ok = yespublic = yes[Pi Home] path = /comment = No commentbrowsable = yesread only = novalid users = writable = yesguest ok = yespublic = yes[Pi Share] path = /home/picomment = No commentbrowsable = yesread only = novalid users = writable = yesguest ok = yespublic = yes" >>/etc/samba/smb.confecho "`date +%H:%M:%S`>>>>>>>>>>等待重启Samba<<<<<<<<<<"sleep 1sudo service smbd restartsleep 3echo "`date +%H:%M:%S`>>>>>>>>>>拉取Docker可视化工具(portainer)<<<<<<<<<<"sudo su -c "docker pull portainer/portainer:latest"echo "`date +%H:%M:%S`>>>>>>>>>>配置Docker可视化工具到9010端口<<<<<<<<<<"docker run -d -p 9010:9000 --name docker-portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock portainer/portainerechoecho "`date +%H:%M:%S`>>>>>>>>>>拉取homeassistant镜像<<<<<<<<<<"docker pull homeassistant/raspberrypi3-homeassistant:latestechoecho "`date +%H:%M:%S`>>>>>>>>>>拉取hassio-supervisor镜像<<<<<<<<<<"docker pull homeassistant/armhf-hassio-supervisor:latestecho "`date +%H:%M:%S`>>>>>>>>>>使用root用户安装 Hass.io<<<<<<<<<<"# docker run -d --name="home-assistant" -v /path/to/your/config:/config -e "TZ= Asia/Chongqing" -p 8123:8123 homeassistant/raspberrypi3-homeassistant:0.84.3sudo su -c "curl -sL -o install.sh /neroxps/hassio_install/master/install.shchmod a+x install.sh./install.sh"echoecho "`date +%H:%M:%S`>>>>>>>>>>安装完成,配置完Portainer后,输出Hassio日志<<<<<<<<<<"echo "`date +%H:%M:%S`>>>>>>>>>>请用浏览器打开IP:9010,完成Portainer的配置"read -p "等待中,按 回车键 进行下一步" echo "`date +%H:%M:%S`>>>>>>>>>>重启Hassio容器并输出日志<<<<<<<<<<"# sudo systemctl restart hassio-supervisor sudo journalctl -fu hassio-supervisor
之后保存退出:Ctrl+O(保存),Ctrl+X(关闭)。
sudo chmod u+x docker_hassio.sh
授予sh文件读写权限
sudo ./docker_hassio.sh 1>&2
执行脚本。
手动打开浏览器,打开你的树莓派IP:9010 登录到portainer 客户端,创建管理账户,回车。
选择左边的Local本地docker服务器
Docker socket to manage a local Docker engine
确定。
然后回到putty,按任意键系统自动安装,并开始输出hassio安装日志。
大约半小时后,基本就安装完成了,打开浏览器 ip:8123就可以了。
/home-assistant/hassio-addons
/tomczhen/hassio-addons.git /neroxps/hassio-addons
/bestlibre/hassio-addons
/danielperna84/hassio-addons
/vkorn/hassio-addons
/gollo/hassio-addons
/sunnythaper/sunnys-hassio
/HerrHofrat/hassio-addons
/balloob/hassio-addon-experiments
/home-assistant/hassio-addons-example
/ohmer1/hassio-addons
/bramkragten/hassio-addons
/adamrutt/hassio-addons
/frenck/incubator
/nalipaz/hassio-addons
/odinuge/hassio-addons
/pstreule/hassio-addons
/charleyzhu/hassio-addons
/notoriousbdg/hassio-addons
/pantomax/haxio
/Romkabouter/hassio-addons