Regular readers may be aware of The Script, created and developed over many months to simplify the otherwise often torturous job of taking a basic Raspberry Pi complete with Raspberry Pi OS and installing a bunch of tools and utilities including Node-Red, Mosquitto MQTT broker, graphing tool Grafana along with Influx and other database tools, text editors, a basic web page and some other useful utilities all as described herein.

The Script has also been used with many other SBCs but recently only tested on Raspberry Pi (3 and 4) because of the immense poularity of these SBCs.

March 06, 2022 Notes

We’ve just had feedback from a subscriber attempting to use the script on Ubuntu. To save anyone wasting time, we currently only work on RPis using the standard Bullseye and Buster installs – earlier versions may well work as may installs on other Linux variations, but for example I no longer own any of the alternative SBCs – near the start of the script file itself (readable with notepad) are dates of changes we’ve made over time.

February 19, 2022 Update

Antonio Fragola and I have today updated the script to handle RPi OS Bullseye while retaining backward compatibility with previous RPi software (i.e. Buster). My thanks to John Morfit and other subscribers who brought a (now resolved) issue with Bullseye to my attention.

I’ve also upgraded the script to mention Cockpit and tested Cockpit in it’s web-page – the default port being :9090 so in my case, from my PC I can access Cockpit in my RPi4 from my PC web browser as 192.168.x.x:9090

Cockpit is a general utility for checking all aspects of operation off, again in my case, my RPi4. That’s useful!

May 14 2020 Update

The Script is being constantly updated and improved – last updated this morning after discovering a flaw in yesterday’s updates – and with more updates on the way,

Here’s the direct link to the self-documented The Script itself. As user pi in your home folder, do this:


Then, in the same default RPi folder, run this…


You will need to enter some passwords 9or your choosing) and select a few simple options then you can go have a cup of tea. Reboot when done and before attempting to use.

sudo reboot

For the benefit of newbies, here is an exact example of usage:

Starting off with a fresh Raspberry RPi 3 or 4, grab the latest Raspbian LITE (or the full version if you really need it – but NOT the NOOBS version, please) and go to the Raspberry Pi site to grab the operating system.

On, for example a Windows PC, run something like BalenaEtcher to flash Raspbian Buster onto a microSD – I suggest 16GB or 32GB unless you need more room for large amounts of data or media – I’ve never gone past maybe 20GB – I generally use Sandisk or Samsung for known reliability.

Once done and verified, while the uSD is still in the PC, copy an empty file called “ssh” without the quotes onto the same microSD (which I’ll refer to from here merely as SD). Then plug the SD into the RPi, connect the RPi to your RJ45 network, plug in a 5v power supply able to handle 3A and the Pi should power up.

Using something like (free) Advanced IP Scanner on your PC, find the RPi and make a note of it’s IP address. Using something like (free) MobaxTerm on the PC, open an SSH session to that address and log into the Pi using user pi and the default password.

Before you do anything else do this on the RPi:

sudo apt update
sudo apt upgrade

At this point I personally install rpi-clone (the instructions are on the github rpi-clone site and also elsewhere in my blog) and then, in the pi folder (default) after installing another blank, good quality SD into the top left USB socket on the RPi via an adaptor, I would then use:

sudo rpi-clone -f -U sda

Maybe 15 minutes later the job will be done and you have a backup of everything – subsequent backups should not need the -f option (which partitions and formats the SD) and will run more quickly, backing up only that which has changed since the last backup.

THEN grab “The Script” as below and run it – again as below.

Note that “The Script” may appear to stall from time to time as some operations occur which have pointless warnings deliberately turned off. It is not possible to turn off ALL warnings due to third party scripts running within “The Script” itself. The running time of “The Script” is dependent on a number of factors, several minutes on a Raspberry Pi 4 and much longer on older hardware.

Finally after rebooting with a working script in place, I personally would take ANOTHER good SD and clone – could save a lot of work.

End of example

Aidan Ruff and I originally developed a script to install Node-Red and several other packages onto the RPi for our own home control purposes. This has since mutated into the very popular “The Script” with help from several people and in particular my friend Antonio “Mr Shark”. “The Script” of course makes use of other scripts put together by countless other developers to install various programs on the Pi and other SBCs.

What is this about?

Node-Red at port 1880 and lots of useful NODESMosquitto (MQTT) with WebsocketsNODEJS/NPMWebmin at port 10000 (off by default)NGINX at port 80HA-Bridge at port 82 (suitable for Amazon Alexa)SQLite and PHPLiteAdminMC File manager and editor (mcedit)Grafana with InfluxDB (OFF unless you select in the menu)Cockpit (visible in a web browser at port 9090)Lots more – see the menu screenTypically this setup would be used as the basis of a nerve-centre to control and monitor home control gadgets such as the ESP8266 units we discuss in this blog, Sonoff controllers and much more. This software can make for a good start in controlling the home – and more importantly can be done YOUR WAY.

Today the ONLY “noisy” script within is the SQLITE section which throws up all sorts of warnings – but which works fine, non-the-less. The rest work quietly without issue. The Node-Red installation now relies on the FIRST option in the Node-Red list and relies on the install-upgrade script by the  IBM guys. Enjoy.

As well as it’s original purpose of effortlessly setting up a Raspberry Pi, “The Script” also runs well with several other boards with RPi 3 and 4 being the most recently tested.  See the right hand side of the image below to see what the script does, given a basic operating system install. 

We currently suggest NOT using this with DIET PI, original Pi or the Raspberry Pi Zero as we are no longer testing either and the latter pair are just TOO SLOW. Note that I refer to Stretch and Buster – in June 2021 I am using the latest RPi operating system.

Home Control using The ScriptFor simplicity, no local Blynk server is installed in the script – see this blog entry, note that I use all lowercase for the Blynk directory name though personally I’ve stopped using Blynk in favour of Node-Red Dashboard.

On non-Raspberry Pi devices, Apache is the default webserver. On the Raspberry Pi, NGINX as now the default webserver as it is compatible and far more modern – you can of course change these options when running the script. Also, whichever web server you use – if you plan to use node-red-contrib-amazon-echo – you might want to shift the working port for Apache (or NGINX) from 80 to 86. Do this in /etc/apache2/sites-enabled/000-default.conf (one reference to change) or if you are using NGINX, change /etc/nginx/sites-enabled/default – two references to 80 change to 86 (my choice). The Amazon echo hub in NR I then set to 8980 and rebooted. The next para is taken from “A Good Day for Alexa” blog entry:

For some time I used port 8980 to avoid being the hated Linux ROOT user and, on my Raspberry Pi 3 and 4 boards,  I moved the web server to port 86 and using “iptables” have redirected port 8980 traffic to port 80 to keep Amazon happy while continuing to use port 8980 to keep Linux happy as PI user. All of this of course only matters if you want to use that particular node in Node-Red – with generation 3 or later DOT and similar Alexa devices.

sudo apt-get install iptables-persistent
sudo iptables -I INPUT 1 -p tcp –dport 80 -j ACCEPT
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp –dport 80 -j REDIRECT –to-port 8980
sudo netfilter-persistent save
sudo netfilter-persistent reload

March 2 2019

Added a useful file/directory operations node to the installed Node-Red nodes along with the strangely missing node-red-contrib-influxdb node. Note that in order to use this you must have opted to install Grafana and Influxdb. Databases in Influxdb are added at the command line (I do this as user pi) simply by invoking the command “influx” and once in, using the commands “CREATE DATABASE mydatabase” (as an example) followed by “exit”. All without quotes and using your choice of database name.

February 2019

Uploaded a new version with mods for Raspbian and in particular Node-Red and nodejs v10.x as currently used by the Node-Red guys on the Raspberry Pi.

Raspberry Pi users should log in a user PI and start with a clean Raspbian. Enable any hardware you want working before installing the script – like I2c.

Raspberry Pi users get the script in your /home/pi directory as per the link at the top of this blog entry – if you are familiar with the tools available (see the script which is of course a readable text file) that should be that – read no further as the rest of this article is old and you will see a file list of what gets installed, in the script itself. Also when the script has run, you should find a simple home-page available in your Raspberry Pi browser which links to the main tools available.

Non-Raspberry Pi users start in your ROOT directory as user ROOT, initially.

Originally designed to run under Debian – reader Antonio and I have also made the script compatible with Xenial in some cases. It now handles Raspbian and the Armbian versions of Debian and Xenial (Ubuntu). Today (July 2019) it is mainly being tested with Raspbian Buster (the current official Raspberry Pi operating system).

One issue I have occasionally with new boards is lack of remote root access to install the script. For example on a Banana Pi 3 I had this.. there was PI access for the likes of WinSCP but not root access. This was easily solved as user Pi – after using “sudo passwd root” to ensure I had a known root password.

sudo sed -i ‘s/prohibit-password/yes/’ /etc/ssh/sshd_config
sudo systemctl restart sshd

That won’t work in all cases but I’m parking that here for reference. The first line is included in The Script and you can probably ignore the above.