树莓派安装homeassistant全流程

1.安装系统

利用balenaEtcher刷写stretch版本固件到SD卡,完毕后,重新插入SD卡,新建一个ssh的文件

开启root账户

sudo passwd root #为root设置密码

sudo passwd --unlock root解锁root账户

会提示:password expiry information changed

sudo nano /etc/ssh/sshd_config

修改PermitRootLogin without-password->PermitRootLogin yes

2.换源

sudo nano /etc/apt/sources.list.d/raspi.list

deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui

包括raspi-config\minecraftpi\桌面环境、内核固件驱动等少量软件

sudo nano /etc/apt/sources.list

deb https://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

3.设置树莓派3 B+的静态IP

修改/etc/dhcpcd.conf 文件

sudo nano /etc/dhcpcd.conf

interface eth0

static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

interface wlan0

static ip_address=192.168.0.200/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

上面的配置文件中 , eth0是有线的配置  , wlan0是无线配置

ip_address就是静态IP , 后面要接/24

routers是网关

static domain_name_servers是DNS

4.编译安装python3.7.3

 

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

安装python依赖环境

sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev libssl-dev openssl libgdbm-dev liblzma-dev libreadline-dev libncursesw5-dev libffi-dev

下载python3.7.3版本源码并解压

wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
tar -xvf Python-3.7.3.tar.xz
cd Python-3.7.3
sudo ./configure --prefix=/usr/local/opt/python3.7
sudo make 
sudo make install

安装Python2.7

wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar -zxf Python-2.7.13.tgz
cd Python-2.7.13
sudo ./configure --prefix=/usr/local/opt/python2.7
sudo make 
sudo make install

安装python2.7的pip

 curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py

安装homeassistant

cd /usr/local/opt/python3.7/bin

sudo ./pip3.7 install --upgrade pip

sudo ./pip3.7 install homeassistant

./hass

安装MPD

https://bbs.hassbian.com/thread-5439-1-1.html

安装MQTT

sudo apt-get install mosquitto

安装NO

DERed

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

上面失效时

sudo apt install npm

npm update -g
npm install -g n
n latest

sudo npm install -g --unsafe-perm node-red

node-red

https://github.com/node-red/node-red

 

你可能感兴趣的:(网络技术)