The Script (Original Article)

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 here until today where it will install software over a basic Debian Jessie installation on a range of boards including but not limited to:

  • Raspberry Pi2
  • Raspberry Pi3 (inc Raspbian "Stretch")
  • 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 - if anyone wants to provide information to make it work - we can look at that.

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,, 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 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. Right now I’m about to install on a BananaPi M2+ and next week we’ll be trying out the Orange Pi Zero (alongside a review of that board). See the later article on this subject here.


26 thoughts on “The Script (Original Article)

  1. Hi
    Scripts works well on Rpi2 but fail on Rpi1 when trying to install nodejs.

    I had to replace this :

    curl -sL >
    sudo bash

    by that :

    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...


    1. 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.

  2. 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 **
    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 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.

    1. 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.

    2. 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.

  3. 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.

  4. Yes I did retrieve it from 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/ 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.

  5. 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.


    1. 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

  6. 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.

  7. 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

    1. run, directly on your linux:
      sudo netstat -lntp
      (should report every active service with open ports and process opening them...

      if you see services are open for every source address, if you see you misconfigured the service...)

      if you see and still can't access, probably you enabled some firewall... list its rules with:
      sudo iptables -L -n

  8. 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)

    1. 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.

  9. 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).



Leave a Reply

Your email address will not be published. Required fields are marked *