Install / Upgrade Node-RED
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
Install Node-RED-Dashboard
cd ~/.node-red
sudo npm install node-red-dashboard
sudo apt-get install libavahi-compat-libdnssd-dev
npm install node-red-contrib-homekit-bridged
npm install node-red-node-mysql
sudo reboot
Install HAP-NodeJS
sudo npm config set registry http://registry.npmjs.org/
sudo npm install -g node-gyp
git clone https://github.com/KhaosT/HAP-NodeJS.git
cd HAP-NodeJS
npm rebuild
npm install
To run the service:
node Core.js
Install nginx
sudo apt-get install nginx
Add php support:
sudo apt-get install php-fpm
cd /etc/nginx
sudo nano sites-enabled/default
find the line with "index index.html index.htm;"
index index.php index.html index.htm;
uncomment the following lines:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
the modified lines should be like these:
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
sudo /etc/init.d/nginx reload
Install mysql
sudo apt-get install mysql-server
sudo mysql_secure_installation
> Use default settings
to login
mysql -u root -p
resetting a lost MySQL root password
http://www.cnblogs.com/xiaojikuaipao/p/mysql_password.html
sudo /etc/init.d/mysql stop
sudo mysqld_safe --skip-grant-tables &
mysql -u root
use mysql;
update user set password=PASSWORD("mynewpassword") where User='root';
flush privileges;
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
add/delete a user
https://www.cnblogs.com/wanghetao/p/3806888.html
To login remotely, set Host to "%" (original value is "localhost")
if interactions with mysql in python is required,
sudo apt-get install python-mysqldb
if PHPMyAdmin is required,
sudo apt-get install phpmyadmin
> Select apache2 even if NGINX is used
> Select yes at the next prompt
sudo ln -s /usr/share/phpmyadmin /var/www/html
Install Mosquitto
wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/
sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list
sudo apt-get install mosquitto
sudo apt-get install mosquitto-clients
config
sudo nano /etc/mosquitto/mosquitto.conf
allow_anonymous false
password_file /etc/mosquitto/passwordfile
add a user choi with password lanseyujie [note: -c means create a new password file]
sudo mosquitto_passwd -c /etc/mosquitto/passwordfile choi
sudo mosquitto_passwd /etc/mosquitto/passwordfile choi
Install FTP
sudo apt-get install -y vsftpd
sudo nano /etc/vsftpd.conf
local_enable=YES
write_enable=YES
anonymous_enable=NO
local_umask=022
local_root=/
sudo service vsftpd restart