The Script – Scargill’s Tech Weblog


Common readers could pay attention to The Script, created and developed over many months to simplify the in any other case usually torturous job of taking a primary Raspberry Pi full with Raspberry Pi OS and putting in a bunch of instruments and utilities together with Node-Crimson, Mosquitto MQTT dealer, graphing instrument Grafana together with Inflow and different database instruments, textual content editors, a primary internet web page and another helpful utilities all as described herein.

The Script has additionally been used with many different SBCs however lately solely examined on Raspberry Pi (3 and 4) due to the immense reputation of those SBCs.

February 26, 2023 Notes

I’m up early on Sunday morning, working The Script on a virgin Raspberry Pi 4 which has put in the newest Bullseye from Raspberry Pi – no points to date and the script has simply completed working. Temperature at completion was 42c on the fanless RPI4 and evidently NodeJS 16.91 and NPM 8.19.3 have been put in. Earlier than working The Script, as consumer Pi, I did the traditional sudo apt replace and sudo apt improve on the command line on this headless set up. I simply checked and Node-Crimson is working by default – white background.

In the meantime I used to be doing this new set up as I needed so as to add ESPHOME to the RPi4 with out chancing messing up my current house management setup (which is on an older model of nearly all the things.

After finishing the script and checking all was nicely on the command line as consumer Pi – I went about including ESPHOME – on this occasion as follows – once more as consumer Pi…

python3 -m venv venv
supply venv/bin/activate
pip3 set up esphome
esphome model

The consequence? ESPHOME model 2023.2.4 put in. Doesn’t get any simpler.

March 06, 2022 Notes

We’ve simply had suggestions from a subscriber trying to make use of the script on Ubuntu. To save lots of anybody losing time, we at the moment solely work on RPis utilizing the usual Bullseye and Buster installs – earlier variations could nicely work as could installs on different Linux variations, however for instance I now not personal any of the choice SBCs – close to the beginning of the script file itself (readable with notepad) are dates of modifications we’ve revamped time.

February 19, 2022 Replace

Antonio Fragola and I’ve at this time up to date the script to deal with RPi OS Bullseye whereas retaining backward compatibility with earlier RPi software program (i.e. Buster). My due to John Morfit and different subscribers who introduced a (now resolved) situation with Bullseye to my consideration.

I’ve additionally upgraded the script to say Cockpit and examined Cockpit in it’s web-page – the default port being :9090 so in my case, from my PC I can entry Cockpit in my RPi4 from my PC internet browser as 192.168.x.x:9090

Cockpit is a normal utility for checking all features of operation off, once more in my case, my RPi4. That’s helpful!

Might 14 2020 Replace

The Script is being always up to date and improved – final up to date this morning after discovering a flaw in yesterday’s updates – and with extra updates on the way in which,

Right here’s the direct hyperlink to the self-documented The Script itself. As consumer pi in your house folder, do that:

wget https://bitbucket.org/api/2.0/snippets/scargill/kAR5qG/grasp/recordsdata/script.sh

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

bash script.sh

You have to to enter some passwords 9or your selecting) and choose a number of easy choices then you’ll be able to go have a cup of tea. Reboot when completed and earlier than trying to make use of.

sudo reboot

For the good thing about newbies, right here is an actual instance of utilization:

Beginning off with a recent Raspberry RPi 3 or 4, seize the newest Raspbian LITE (or the complete model if you actually need it – however NOT the NOOBS model, please) and go to the Raspberry Pi web site to seize the working system.

On, for instance a Home windows PC, run one thing like BalenaEtcher to flash Raspbian Buster onto a microSD – I recommend 16GB or 32GB until you want extra room for giant quantities of information or media – I’ve by no means gone previous perhaps 20GB – I usually use Sandisk or Samsung for recognized reliability.

As soon as completed and verified, whereas the uSD continues to be within the PC, copy an empty file referred to as “ssh” with out the quotes onto the identical microSD (which I’ll check with from right here merely as SD). Then plug the SD into the RPi, join the RPi to your RJ45 community, plug in a 5v energy provide in a position to deal with 3A and the Pi ought to energy up.

Utilizing one thing like (free) Superior IP Scanner in your PC, discover the RPi and make a remark of it’s IP handle. Utilizing one thing like (free) MobaxTerm on the PC, open an SSH session to that handle and log into the Pi utilizing consumer pi and the default password.

Earlier than you do the rest do that on the RPi:

sudo apt replace
sudo apt improve

At this level I personally set up rpi-clone (the directions are on the github rpi-clone web site and in addition elsewhere in my weblog) after which, within the pi folder (default) after putting in one other clean, good high quality SD into the highest left USB socket on the RPi through an adaptor, I might then use:

sudo rpi-clone -f -U sda

Perhaps quarter-hour later the job shall be completed and you’ve got a backup of all the things – subsequent backups shouldn’t want the -f possibility (which partitions and codecs the SD) and can run extra shortly, backing up solely that which has modified for the reason that final backup.

THEN seize “The Script” as beneath and run it – once more as beneath.

Observe that “The Script” could seem to stall every now and then as some operations happen which have pointless warnings intentionally turned off. It’s not potential to show off ALL warnings because of third get together scripts working inside “The Script” itself. The working time of “The Script” depends on numerous elements, a number of minutes on a Raspberry Pi 4 and for much longer on older {hardware}.

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

Finish of instance

Aidan Ruff and I initially developed a script to put in Node-Crimson and a number of other different packages onto the RPi for our own residence management functions. This has since mutated into the very talked-about “The Script” with assist from a number of folks and particularly my buddy Antonio “Mr Shark”. “The Script” after all makes use of different scripts put collectively by numerous different builders to put in varied applications on the Pi and different SBCs.

What is that this about?

  • Node-Crimson at port 1880 and plenty of helpful NODES
  • Mosquitto (MQTT) with Websockets
  • NODEJS/NPM
  • Webmin at port 10000 (off by default)
  • NGINX at port 80
  • HA-Bridge at port 82 (appropriate for Amazon Alexa)
  • SQLite and PHPLiteAdmin
  • MC File supervisor and editor (mcedit)
  • Grafana with InfluxDB (OFF until you choose within the menu)
  • Cockpit (seen in an internet browser at port 9090)
  • Tons extra – see the menu display screen

Usually this setup can be used as the premise of a nerve-centre to manage and monitor house management devices such because the ESP8266 items we talk about on this weblog, Sonoff controllers and way more. This software program could make for a very good begin in controlling the house – and extra importantly might be completed YOUR WAY.

In the present day the ONLY “noisy” script inside is the SQLITE part which throws up all kinds of warnings – however which works high-quality, non-the-less. The remainder work quietly with out situation. The Node-Crimson set up now depends on the FIRST possibility within the Node-Crimson listing and depends on the install-upgrade script by the  IBM guys. Get pleasure from.

In addition to it’s authentic objective of effortlessly organising a Raspberry Pi, “The Script” additionally runs nicely with a number of different boards with RPi 3 and 4 being probably the most lately examined.  See the fitting hand aspect of the picture beneath to see what the script does, given a primary working system set up. 

We at the moment recommend NOT utilizing this with DIET PI, authentic Pi or the Raspberry Pi Zero as we’re now not testing both and the latter pair are simply TOO SLOW. Observe that I check with Stretch and Buster – in June 2021 I’m utilizing the newest RPi working system.

Home Control using The Script

For simplicity, no native Blynk server is put in within the script – see this weblog entry, observe that I exploit all lowercase for the Blynk listing identify although personally I’ve stopped utilizing Blynk in favour of Node-Crimson Dashboard.

On non-Raspberry Pi gadgets, Apache is the default webserver. On the Raspberry Pi, NGINX as now the default webserver as it’s appropriate and way more trendy – you’ll be able to after all change these choices when working the script. Additionally, whichever internet server you employ – in case you plan to make use of node-red-contrib-amazon-echo – you may need to shift the working port for Apache (or NGINX) from 80 to 86. Do that in /and so on/apache2/sites-enabled/000-default.conf (one reference to alter) or if you’re utilizing NGINX, change /and so on/nginx/sites-enabled/default – two references to 80 change to 86 (my selection). The Amazon echo hub in NR I then set to 8980 and rebooted. The subsequent para is taken from “A Good Day for Alexa” weblog entry:

For a while I used port 8980 to keep away from being the hated Linux ROOT consumer and, on my Raspberry Pi 3 and 4 boards,  I moved the online server to port 86 and utilizing “iptables” have redirected port 8980 site visitors to port 80 to maintain Amazon joyful whereas persevering with to make use of port 8980 to maintain Linux joyful as PI consumer. All of this after all solely issues if you wish to use that specific node in Node-Crimson – with technology 3 or later DOT and comparable Alexa gadgets.

sudo apt-get set up 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 helpful file/listing operations node to the put in Node-Crimson nodes together with the unusually lacking node-red-contrib-influxdb node. Observe that with a view to use this you should have opted to put in Grafana and Influxdb. Databases in Influxdb are added on the command line (I do that as consumer pi) just by invoking the command “inflow” and as soon as in, utilizing the instructions “CREATE DATABASE mydatabase” (for example) adopted by “exit”. All with out quotes and utilizing your selection of database identify.

February 2019

Uploaded a brand new model with mods for Raspbian and particularly Node-Crimson and nodejs v10.x as at the moment utilized by the Node-Crimson guys on the Raspberry Pi.

Raspberry Pi customers ought to log in a consumer PI and begin with a clear Raspbian. Allow any {hardware} you need working earlier than putting in the script – like I2c.

Raspberry Pi customers get the script in your /house/pi listing as per the hyperlink on the high of this weblog entry – if you’re acquainted with the instruments accessible (see the script which is after all a readable textual content file) that must be that – learn no additional as the remainder of this text is previous and you will note a file listing of what will get put in, within the script itself. Additionally when the script has run, it is best to discover a easy home-page accessible in your Raspberry Pi browser which hyperlinks to the primary instruments accessible.

Non-Raspberry Pi customers begin in your ROOT listing as consumer ROOT, initially.

Initially designed to run underneath Debian – reader Antonio and I’ve additionally made the script appropriate with Xenial in some circumstances. It now handles Raspbian and the Armbian variations of Debian and Xenial (Ubuntu). In the present day (July 2019) it’s primarily being examined with Raspbian Buster (the present official Raspberry Pi working system).

One situation I’ve often with new boards is lack of distant root entry to put in the script. For instance on a Banana Pi 3 I had this.. there was PI entry for the likes of WinSCP however not root entry. This was simply solved as consumer Pi – after utilizing “sudo passwd root” to make sure I had a recognized root password.

sudo sed -i 's/prohibit-password/sure/' /and so on/ssh/sshd_config
sudo systemctl restart sshd

That received’t work in all circumstances however I’m parking that right here for reference. The primary line is included in The Script and you’ll most likely ignore the above.

Facebooktwitterpinterestlinkedin