下载 Raspbian
https://www.raspberrypi.org/downloads/raspbian/
制作 TF card
1 2 3 4 5
| df -h diskutil unmount /dev/disk2s1 diskutil list dd bs=4m if=2017-01-11-raspbian-jessie.img of=/dev/rdisk2 diskutil unmountdisk /dev/disk2
|
note:新的img默认没有打开ssh,在tf卡根目录新建名称为 ssh 的文件夹解决
登录树莓派
1
| ssh pi@raspberrypi.local
|
更新源
1 2
| sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo vi /etc/apt/sources.list
|
进入编辑界面,用 # 注释掉原来的源,添加下方的源。
1
| deb http://mirrors.neusoft.edu.cn/raspbian/raspbian jessie main contrib non-free rpi
|
更新
1
| sudo apt-get update && sudo apt-get upgrade -y
|
安装解决依赖
1 2
| sudo apt-get install avahi-daemon avahi-discover libnss-mdns libavahi-compat-libdnssd-dev build-essential -y service avahi-daemon start
|
增加nodejs源
1 2
| cd ~ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
|
安装nodejs
1 2 3 4 5 6 7
| cd ~/Downloads wget http://nodejs.org/dist/v7.6.0/node-v7.6.0.tar.gz tar -xzf node-v7.6.0.tar.gz cd node-v7.6.0 ./configure make sudo make install
|
克隆HAP-NodeJS源码
1
| git clone https://github.com/KhaosT/HAP-NodeJS.git
|
安装node-gyp
1
| sudo npm install -g node-gyp
|
切换到HAP-NodeJS文件夹下,运行
1 2
| sudo npm istall node Core.js
|