## "The Script" is the product of years of work by me (Peter Scargill) and others, in particular Antonio Fragola (Mr Shark)
## Supports Raspberry Pi with Buster - also other boards and op systems but since 2021 this
## script is only tested on Raspberry Pi (2,3,4) (Raspberry Pi OS, formerly Buster) (full or lite, not NOOBS). See below and if you
-##try it on other systems with success, please let mne know.
+## try it on other systems with success, please let mne know.
## Makes use of the official Node-Red script (which I DIDN'T write) and my own Node-Red nodes such as BigTimer.
## stats32.py - this lot for people who want to run ssd1306 displays (32 or 64 px high)
## in Python rather than installing i2c support in Node-Red
+## Includes (if selected - Webmin is not selected by default):
## Mosquitto (port 1883) with web sockets (Port 9001)
## SQLITE ( xxx.xxx.xxx.xxx/phpliteadmin),
-## Node-Red (xxx.xxx.xxx:1880)
+## Node-Red (xxx.xxx.xxx.xxx:1880)
## Node-Red-Dashboard (xxx.xxx.xxx.xxx:1880/ui)
-## Webmin (xxx.xxx.xxx:10000)
-## Apache (xxx.xxx.xxx) (recommend replacing using nginx)
+## Webmin (xxx.xxx.xxx.xxx:10000)
+## Apache (xxx.xxx.xxx.xxx) (recommend replacing using nginx)
-## Grafana (xxx.xxx.xxx:3000) - defaults to password "password" and offers to let you change it.
+## Grafana (xxx.xxx.xxx.xxx:3000) - defaults to password "password" and offers to let you change it.
## Web-page-based software like mc, micro and phpsysinfo.
+## Cockpit Web Console (xxx.xxx.xxx.xxx:9090)
## 1. Run initially ONLY as user PI on Raspberry Pi (or ROOT on other hardware). If ROOT, PI user will be checked/created for you as the main
## We cannot answer questions on board/operating system combinations we have not tested. See notes below for tested combos and dates.
-## 01/08/2021 It seems for nwo there's an issue of influxdb no longer being available for RPi (32 bit). While we're working on that I suggest NOT installing Grafana from the script.
+## 19/02/2022 - The software works with Raspberry Pi OS Bullseye (11) and is backward-compatible with BUSTER.
+## 01/08/2021 - It seems for now there's an issue of influxdb no longer being available for RPi (32 bit). While we're working on that I suggest NOT installing Grafana from the script.
## 20/06/2020 - RPi added more useful NR contrib nodes
## 08/06/2020 - Changed the version of the Node-Red script as NR have made a change
## 24/05/2020 - Fix for extra tabs on PI Cockpit addition - thanks to Dominic
# Whiptail menu may already be installed by default, on the other hand maybe not.
sudo apt-get $AQUIET -y install whiptail ccze net-tools 2>&1 | tee -a $LOGFILE
+sudo apt -y reinstall librtmp1 2>&1 | tee -a $LOGFILE
# Another way - Xenial should come up in upper case in $DISTRO
sudo sed -i '$ a ClientAliveCountMax 100' /etc/ssh/sshd_config
sudo /etc/init.d/ssh restart 2>&1 | tee -a $LOGFILE
- sudo update-alternatives --set newt-palette /etc/newt/palette.original 2>&1 | tee -a $LOGFILE
+ # sudo update-alternatives --set newt-palette /etc/newt/palette.original 2>&1 | tee -a $LOGFILE
echo "Dpkg::Progress-Fancy \"1\";" | sudo tee /etc/apt/apt.conf.d/99progressbar > /dev/null
# Prerequisite suggested by Julian and adding in python-dev - and stuff I've added for SAMBA and telnet, and Common utilities
sudo apt-get install $AQUIET -y apt-utils 2>&1 | tee -a $LOGFILE # a line on its own, as on some boards caused problems on next one...
- sudo apt-get install $AQUIET -y nmap netdiscover sysfsutils tcpdump pure-ftpd wget ssh bash-completion unzip build-essential git python-serial scons libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libsqlite3-dev subversion libcurl4-openssl-dev libusb-dev python-dev cmake curl telnet usbutils gawk jq pv samba samba-common samba-common-bin winbind dosfstools parted gcc python-pip htop python-smbus mc cu mpg123 screen 2>&1 | tee -a $LOGFILE
+ sudo apt-get install $AQUIET -y nmap netdiscover sysfsutils tcpdump pure-ftpd wget ssh bash-completion unzip build-essential git python3-serial scons libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libsqlite3-dev subversion libcurl4-openssl-dev libusb-dev python3-dev cmake curl telnet usbutils gawk jq pv samba samba-common samba-common-bin winbind dosfstools parted gcc python3-pip htop python3-smbus mc cu mpg123 screen 2>&1 | tee -a $LOGFILE
sudo pip -q install psutil 2>&1 | tee -a $LOGFILE
sudo -H pip -q install feedparser 2>&1 | tee -a $LOGFILE
# This line to ensure name is resolved from hosts FIRST
if [[ $MYMENU == *"apache"* ]]; then
printstatus "Installing Apache/PHP and Sqlite"
if [[ $OPSYS != *"UBUNTU"* ]]; then
+ if [[ $OPSYS == *"BIAN"* ]] && [[ $DISTRO == *"11"* ]]; then
+ sudo apt-get $AQUIET -y install apache2 libapache2-mod-php7.4 sqlite3 php-sqlite4 php-xml php-mbstring 2>&1 | tee -a $LOGFILE
if [[ $OPSYS == *"BIAN"* ]] && [[ $DISTRO == *"10"* ]]; then
sudo apt-get $AQUIET -y install apache2 libapache2-mod-php7.3 sqlite3 php-sqlite3 php-xml php-mbstring 2>&1 | tee -a $LOGFILE
if [[ $MYMENU == *"nginx"* ]]; then
printstatus "Installing NGINX/PHP and Sqlite"
+ if [[ $OPSYS == *"BIAN"* ]] && [[ $DISTRO == *"11"* ]]; then
+ sudo apt-get $AQUIET -y remove --purge *apache* *php* 2>&1 | tee -a $LOGFILE
+ sudo apt-get $AQUIET -y autoremove 2>&1 | tee -a $LOGFILE
+ sudo apt-get $AQUIET -y install nginx sqlite3 php php7.4-{common,cli,fpm,json,zip,gd,mbstring,curl,xml,bcmath,sqlite3} php-pear 2>&1 | tee -a $LOGFILE
+ [ $? -eq 0 ] && webserver=1 # nginx installed
+ sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
+ sudo sed -i -e 's/index index.html/index index.php index.html/g' /etc/nginx/sites-enabled/default
+ sudo sed -i -e 's/#location ~ \\.php$ {/location ~ \\.php$ {/g' /etc/nginx/sites-enabled/default
+ sudo sed -i -e 's/#.*include snippets\/fastcgi/ include snippets\/fastcgi/g' /etc/nginx/sites-enabled/default
+ sudo sed -i -e 's/#.*fastcgi_pass unix/ fastcgi_pass unix/g' /etc/nginx/sites-enabled/default
+ sudo sed -i -e '63s/#}/}/' /etc/nginx/sites-enabled/default
+ sudo systemctl restart nginx php7.4-fpm
if [[ $OPSYS == *"BIAN"* ]] && [[ $DISTRO == *"10"* ]]; then
sudo apt-get $AQUIET -y remove --purge *apache* *php* 2>&1 | tee -a $LOGFILE
sudo apt-get $AQUIET -y autoremove 2>&1 | tee -a $LOGFILE
sudo sed -i -e 's/#.*include snippets\/fastcgi/ include snippets\/fastcgi/g' /etc/nginx/sites-enabled/default
sudo sed -i -e 's/#.*fastcgi_pass unix/ fastcgi_pass unix/g' /etc/nginx/sites-enabled/default
sudo sed -i -e '63s/#}/}/' /etc/nginx/sites-enabled/default
- #sudo systemctl restart nginx php7.3-fpm
+ sudo systemctl restart nginx php7.3-fpm
# if apache OR nginx installed and /var/www/html exists, go on...
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
- ## curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered > update-nodejs-and-nodered
+ curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered > update-nodejs-and-nodered
echo 143.204.15.127 deb.nodesource.com | sudo tee -a /etc/hosts
chmod +x update-nodejs-and-nodered
echo y | ./update-nodejs-and-nodered
test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "9" && echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "10" && echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
+ test $VERSION_ID = "11" && echo "deb https://repos.influxdata.com/debian bullseye stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "16.04" && echo "deb https://repos.influxdata.com/ubuntu xenial stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
curl -sL https://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
curl -sL https://packages.grafana.com/gpg.key | sudo apt-key add -