Skip to content

Instantly share code, notes, and snippets.

@teos0009
Created January 2, 2016 09:10
Show Gist options
  • Save teos0009/8f424acb2352045c65f9 to your computer and use it in GitHub Desktop.
Save teos0009/8f424acb2352045c65f9 to your computer and use it in GitHub Desktop.
##nodered ip 192.168.13.129:1880
nodered ip 192.168.1.104:1880
#chk for node installed
dpkg --get-selections | grep node
#uninstall
sudo apt-get remove --purge node
#install generic sw
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install python-software-properties python g++ make -y
sudo apt-get install software-properties-common wget unzip -y
#using PPA method for node
sudo add-apt-repository ppa:chris-lea/node.js -y
sudo apt-get update
sudo apt-get install nodejs -y
#using apt for nodejs
sudo apt-get install nodejs
sudo apt-get install npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
#using maintained pkg for ubuntu
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node
#npm method nodered
sudo npm install -g --unsafe-perm node-red
#gitclone method node red
git clone https://github.com/node-red/node-red.git
cd node-red
npm install
#build node red
sudo npm install -g grunt-cli
grunt build
node red
#start node red
node red
#Server now running at http://127.0.0.1:1880/
#install noderedpid
npm install node-red-node-pidcontrol
#check version
node -v
npm -v
#mqtt with mosquito client & server on ubuntu
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update
sudo apt-get install mosquitto
sudo aptitude install mosquitto-clients
#chk process
ps -A | grep mosquitto
#test mosquito
#subscribe to a topic: mytopic, utopic
mosquitto_sub -t mytopic -d
mosquitto_sub -t utopic -d
#create data file to be publish, use a text "data1"
touch pub.txt
nano pub.txt
data1
#publish to topic
mosquitto_pub -t mytopic -f pub.txt -d
mosquitto_pub -d -t mytopic -m "data2"
mosquitto_pub -d -t mytopic -m "10"
#test on mosquitto free server
mosquitto_sub -h test.mosquitto.org -t "#" -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment