It occurs to me that I regularly refer to my “script” – without ever having detailed what it does! I’ll fix that now.
The “script” is something Aidan and I originally put together for our own use, mainly to help when running home control systems – to simplify Debian Jessie installations on the Raspberry Pi to suit our purposes. Over time as I have reviewed various SBC boards I’ve modified the script with LOTS of feedback from readers (In particular Mr Shark) to something that will today install software over a basic Debian Jessie, Stretch or Buster installation on a range of boards including but not limited to:
- Raspberry Pi2
- Raspberry Pi3
- Raspberry Pi4 (inc Buster)
- NanoPi M1, Neo etc
- Chip
- Orange Pi PC (Armbian)
- Roseapple Pi (Armbian)
- BananaPi M2+ (which came up with 3 usable UARTS in Node-Red!)
- Orange Pi Zero
- Various FriendlyArm boards
- Various VMs (Debian 8, XENIAL, DIETPI and PIXEL)
As the Raspberry Pi 1 is a little underpowered and old – it is not supported – similarly Pi Zero is not really powerful enough for some of the packages – if anyone wants to provide information for potential upgrades to “The Script” – we can look at that with a view to incorporating changes. Be sure to comment any and all lines of change before requesting changes.
The software installed using this script includes
- Python, Samba, Telnet
- Mosquitto with Websockets
- Apache with PHP, SQLITE and PHPLiteAdmin
- NodeJS
- Node-Red including:
- node-ned-nontrib-config
- rode-red-contrib-grove
- node-red-contrib-diode
- node-red-contrib-bigtimer
- node-red-contrib-esplogin
- node-red-contrib-timeout
- node-red-contrib-openweathermap
- node-red-contrib-google
- node-red-contrib-sqlite
- node-red-contrib-emoncms
- node-red-contrib-geofence
- node-red-contrib-ivona
- node-red-contrib-moment
- node-red-contrib-particle
- node-red-contrib-web-worldmap
- node-red-contrib-sqldbs
- node-red-contrib-ramp-thermostat
- node-red-contrib-graphs
- node-red-contrib-isonline
- node-red-node-ping
- node-red-node-random
- node-red-node-smooth
- node-red-contrib-npm
- node-red-contrib-file-function
- node-red-contrib-boolean-logic
- node-red-node-arduino
- node-red-contrib-blynk-websockets
- node-red-dashboard
- node-red-node-darksky
- node-red-node-serialport
- node-red-contrib-owntracks
- node-red-contrib-chatbot
- GPIO library as appropriate
- Webmin
- MPG123
- Screen
- PHPSysinfo
- CU
- MC (and editor)
- HA-Bridge
Node-Red packages have been added recently and some removed (admin which is no longer needed as there is a package manager built into Node-Red). Also some changes have been made to make non-root GPIO easier.
Firstly let me state that this was built for our own purpose and is neither guaranteed to work nor supported. You should have a clean Debian (or Ubuntu or Raspbian) installation with perhaps 8GB of SD – though this lot won’t actually add much and on a Raspberry Pi if you get rid of WolfRam (one of the menu options) you’ll save more than you lose! That and LibreOffice take up a massive amount of space and if you’re an experimenter I’m assuming you’re not likely to need either. 8GB of SD typically leaves LOADS of space for files and future additions.
If this script is to work you should create a user “pi” when setting up the board – clearly a Raspberry Pi will have this already. Copy the script – call it, say, script.sh, into the pi directory and make sure it has execute rights. You should be logged in as user pi to do this. Then run the script – could take half an hour or twice that long – depends on the board. You will be asked simple questions about passwords etc.
And that is it – the script if it runs correctly (will likely show up some WARNINGS on the way – ignore – and NPM ERRORS which aren’t errors) will at the end suggest a reboot – do the reboot – and you should be up and running. Don’t attempt this if you’re not familiar with running scripts and have absolutely no related experience. It is simple, it should run, but I don’t provide a support workshop other than people asking questions in here which I or another reader may respond to.
If it all works well, you should find Node-Red on port 1880, Webmin (if selected) on port 10000 and at port 80 you should have Apache with default pages. With some boards, it may be necessary to change permissions on serial ports if you can’t open them and of course parallel port operation from Node-Red other than real Raspberry Pi is likely to require using the EXEC node – explaining that is beyond the scope of this article and may be trivial or non-trivial Generally, I’ve managed to get port access without requiring a degree in Linux.
Always happy to listen to TESTED changes to the script with a view to incorporating more useful features. We’ve already tested on a BananaPi M2+ and Orange Pi Zero (alongside a review of the latter). See the later article on this subject here.
Peter,
Thank you very much for the effort that you and your crew have put in to writing and testing “The Script”.
You can now add to your hardware list, the fact that “The Script” works flawlessly on the OrangePi Plus 2 (An Allwinner H3 CPU).
Thanks,
RoyG
Thanks for that RoyG – suitably noted in the script. We have an updated version on the way but not yet fully tested.
remember to add this new line to the script i sent you 🙂
I’ve been trying to get this to run on a fresh install on a Pi3 but it hangs at the following point each time it is run. I’ve made no changes to the script.
Disabling serial port login at boot time, you may be asked for your password
Checking if serial port login is enabled
Serial port login does not appear to be enabled, skipping
raspi-io@7.2.3 node_modules/raspi-io
├── raspi-io-core@1.0.1
├── raspi-led@1.5.5 (raspi-peripheral@1.6.4)
├── raspi-board@4.0.2 (@types/node@0.0.2)
├── raspi-pwm@3.1.3 (raspi-peripheral@1.6.4, nan@2.5.1)
├── raspi@3.0.5 (nan@2.5.1)
├── raspi-gpio@3.1.1 (raspi-peripheral@1.6.4, nan@2.5.1)
├── raspi-soft-pwm@2.0.2 (raspi-peripheral@1.6.4, pigpio@0.3.4)
├── raspi-i2c@5.0.3 (ini-builder@1.0.3, raspi-peripheral@1.6.4, i2c-bus@1.2.0)
└── raspi-serial@3.0.5 (raspi-peripheral@1.6.4, serialport@4.0.7)
I believe that Node-Red now does NOT install serial port by default. Wonder if that has anything to do with it. I just go in later and reinstall the serial port. Talk to Node-Red guys about that.
Very strange thing.. After smoothly installation, all services are up and running, but port 1883 is closed even services are active…
On other SD card i have only mosquito and node red and working without any problem
run, directly on your linux:
sudo netstat -lntp
(should report every active service with open ports and process opening them…
if you see 0.0.0.0 services are open for every source address, if you see 127.0.0.1 you misconfigured the service…)
if you see 0.0.0.0 and still can’t access, probably you enabled some firewall… list its rules with:
sudo iptables -L -n
First of all I want to thank you Pete for this excellent and informative blog.
It has helped me a lot. I´m trying to build a small HA system, starting now with a arduino-based weatherstation I built some years ago. I deployed your script to install on a Banana Pi with bananian 16.04, it worked well. Everything works so far after a few modifications. As this OS does not yet use systemd for autostarts these have to be set up in init.d. To use phpLiteAdmin i had to install php7.0-mbstring manually. Now I´m developing my UI using node-red which is a marvelous tool. Still some confusion about access rights but now data gets stored in the DB.
I generally just set access rights so everyone can do anything – well, there’s only me!
Glad it is all working for you.Oh, new updates for Node-Red and I’ve updated node-red-contrib-esplogin and node-red-contrib-bigtimer recently!
Thanks for the tips DrFragle and MrShark 🙂
First, “Systemic” is the user who made the 2nd post on this blog with his changes to run on a Pi 1 B+.
Second, when I said I logged in using user pi, that was via Putty. I cannot log in to node-red as it fails on startup. I tried to log in via Putty as the admin user but it said “access denied”.
Third, I’ve decided after many failed attempts yet another tack is required. I will restore my Jessie initial installation and then install the minimum I can get away with, using bits from this script: some of the prerequisites, nodejs, nodered (with no extra nodes), upgrade NPM. Not too sure if I need to update java and php to 7. If that works then after another backup to add in just the nodes I need.
I urgently need to get my system operational as I have condensation in the loft (house is over insulated!) and need to operate extractor fans.
Longer term, to expand into monitoring other things in the house and implement energy management, then I will need a different architecture as I’ve used most of the GPIO pins (see photo). As Pete has done will need to using slave microprocessors. So later in the year I might buy a Pi 3 and build system 2 using Pete’s approach.
Thanks guys for all your help. It’s great development you are doing.
Alan
then DON’T use the script to do the node-red part, as you said, use it only to install all the remaining stuff, and do the node-red part manually…
you can’t login as “admin” on linux, it’s a reserved user, the admin user is used ONLY in node-red gui, and it’s a different “admin”, not related to the shell user, which we never used… you need to use “pi” as that’s the correct user…
you have problems with npm way before you try to update it, so that’s not a problem… and php7 is not needed, we added it to have a consistent setup on all the platforms supported, instead of the old php5
Yes I did retrieve it from https://bitbucket.org/snippets/scargill/ on 3rd Jan though I see it has changed again today (5th).
I modified the script as per Systemic for the B+ running Jessie. Ran it but it failed at “sudo service nodered start ” (line 632 in the latest). This was due I believe to Systemic’s changes now needing an extra line: “cd ..” Otherwise node red gets installed in directory “home/pi/node-v4.0.0-linux-armv6l” rather than “home/pi/”.
I restart the script from the node-red install and it seemed to go well* but Node-Red is having problems starting and loops trying to restart. The errors coming out are:
pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/bin/python -u
/usr/local/lib/node_modules/node-red/nodes/core/hardware/nrgpio.py info
[warn] [bigtimer] SyntaxError: Unexpected token ILLEGAL
wiringPiSetup: Must be root. (Did you forget sudo?)
nodered.service: main process exited, code=killed, status=6/ABRT
Could this be due to not uninstalling node-red first?
I’ve logged in as pi which is also the user name input in the script and ran “sudo node-red-start”. Can’t log in with the admin name I gave to the script, says user not known.
* actually Webmin is still failing to install as stated earlier, but I can manage without it.
what’s systemic? We tried script on STANDARD dietpi, raspbian, ubuntu and debian, NOTHING else…
I’m glad Antonio answered that – what is Systemic ?
I’ve now found your script ” last modified 13 hours ago” and with a comment “December 26, 2016 – complete re-hash for new menus”. I will restore and rerun.
old! The only version you should use is the latest you can find in this page: https://bitbucket.org/snippets/scargill/
Thanks Peter. I thought I had retrieved the latest script. It has on line 10 “10/12/2016 Tested on Pi3 with latest software Jessie “. According to my notes I retrieved it on 1 Jan.
For the record this took 3.5 hours on a RaspPi 1 B+ using Systemic mods. Thank you to Systemic and Peter.
Got a few errors:
At very end of “Install Apache Installation with PHP and SQLITE and PHPLITEADMIN?”:
Error: incomplete SQL: .exit
At very end of “Install Webmin?”:
E: The method driver /usr/lib/apt/methods/https could not be found.
At “Starting the Node-Red service “:
sed: can’t read .node-red/settings.js: No such file or directory – but file does exist
Result using Pete’s Utility page:
Webmin Adminstrator Unable to connect
Node Red Control Panel OK
Node Red UI Desktop Cannot GET /ui at http://192.168.1.19:1880/ui **
OPI Monitor (if installed – Armbian+H3) Not installed
SQLite Administrator OK
System Information OK – takes some time
Download the Home Control Doc File OK
Pete’s technical website OK
** I note Pete’s https://tech.scargill.net/node-red-dashboard/ recommending uninstalling UI and installing Dashboard
I note in the console log that johnny-five 0.10.6 is installed but I have no J5 nodes. On the other hand I’ve had issues with J5 in my previous install (when node-red bricked) and I was advised “Looks like the latest raspi-io is pulling in the latest serialport which locks on linux by default. Try version 5 of raspi-io.” and “The Python based Rpi.gpio nodes are broken, but they are kinda redundant anyway since the J5 gpio nodes are so much faster. ”
I’ve built a loft monitoring system with fan air extraction (hardware works using python test scripts) but plan to use node-red and javascript for production. I need to get temp/humidity from DHT22 and/or BMP280/BME280s (DHT22’s give very different readings so about to try BMP/E280s ). My user logic requires taking an average of multiple sensors, so I’m thinking of doing all the readings in a Function node rather than a series of linked DHT22 nodes (and I’ve yet to find a BMP/E node). Seems more straightforward and avoids J5 and it’s issues. Thoughts welcome.
The SQL error was sorted ages ago – suggest you try the current script. Also nothing I do supports Raspberry Pi 1 as I would assume it is too slow for the job. I usually refer to Raspberry Pi2 or 3 in my projects.
Hello. Regarding the “Cannot GET /ui” error when trying to access the dashboard, was there a resolution? I am having the same problem and don’t know why. Installation of Node-red was successful and there were no errors when I installed the dashboard.
Just wanted to say thanks for the script Peter, it worked great on a OrangePi Plus 2e.
Hi
Scripts works well on Rpi2 but fail on Rpi1 when trying to install nodejs.
I had to replace this :
curl -sL https://deb.nodesource.com/setup_4.x > nodesetup.sh
sudo bash nodesetup.sh
by that :
wget https://nodejs.org/dist/v4.0.0/node-v4.0.0-linux-armv6l.tar.gz
tar -xvf node-v4.0.0-linux-armv6l.tar.gz
cd node-v4.0.0-linux-armv6l
sudo cp -R * /usr/local/
This was due to arm6 vs arm7 nodejs version.
Other than that, few error with some npm package but the whole script is really good and help to have a working Rpi pretty quickly.
One missing bit around authentication enablement for node-red. You need to install node-red-admin in order to use the hash-pwd function…
Great job…
Systemic
I’d assumed the Pi would be too slow and so didn’t bother supporting it.
Node-Red – no you don’t – I just copy an authentication block into settings.js – but if you have a neater way – fire away – mine way is a bit naff.
Marginally on-topic post 🙂
Regarding the Orange Pi Zero, there’s a good 3d printer case model here:-
https://www.thingiverse.com/thing:1918590
I’ve printed a couple and they are a good fit.