Skip to content

Instantly share code, notes, and snippets.

@djdunc
Last active October 14, 2022 16:34
Show Gist options
  • Save djdunc/7e389d8ba4e87b6d0e5711bdbab27772 to your computer and use it in GitHub Desktop.
Save djdunc/7e389d8ba4e87b6d0e5711bdbab27772 to your computer and use it in GitHub Desktop.
CASA0014 plantmonitor RPi setup
#!/bin/bash
# CASA0014 - Plant Monitor RPi Setup Script
# Author: Duncan Wilson (@djdunc)
# Date: 14-10-2022
# Updated: 14-10-2022
# Version: 1.0.0
# -- Instructions --------------------------------------------------------------
# 1. Download this file to your desktop
# 2. Open Terminal.app (CMD-Spacebar then type Terminal.app) on Mac
# 3. Type: scp ~/Desktop/plantmonitor.sh pi@staff-pi-casa0014:~/
# 4. SSH into pi - Type: ssh pi@staff-pi-ucjtdjw.local
# 5. Type: chmod +x plantmonitor.sh
# 6. Type: ./plantmonitor.sh
# ------------------------------------------------------------------------------
echo "============================="
echo "OS installed is:"
echo "============================="
cat /etc/os-release
echo " "
echo "============================="
echo "Make sure all us up to date:"
echo "============================="
sudo apt update
sudo apt upgrade -y
echo " "
echo "============================="
echo "Install InfluxDB:"
echo "============================="
# get key for install
wget -q https://repos.influxdata.com/influxdb.key
echo '23a1c8836f0afc5ed24e0486339d7cc8f6790b83886c4c96995b88a061c5bb5d influxdb.key' | sha256sum -c && cat influxdb.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdb.gpg > /dev/null
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list
# run update to get InfluxDB package and run upgrade
sudo apt-get update
sudo apt-get install influxdb2 -y
# to get InfluxDB up and running at reboot we need to enable and start it within systemctl:
sudo systemctl unmask influxdb.service
sudo systemctl start influxdb
sudo systemctl enable influxdb.service
echo " "
echo "============================="
echo "Install Telegraf:"
echo "============================="
sudo apt-get update && sudo apt-get install telegraf -y
echo " "
echo "============================="
echo "InfluxDB and Telegraf install complete"
echo " "
echo "============================="
echo "Install Grafana:"
echo "============================="
sudo apt-get install -y adduser libfontconfig1
wget https://dl.grafana.com/enterprise/release/grafana-enterprise_9.2.0_arm64.deb
sudo dpkg -i grafana-enterprise_9.2.0_arm64.deb
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable grafana-server
sudo /bin/systemctl start grafana-server
echo " "
echo "============================="
echo "All done"
echo "============================="
echo "Type: sudo reboot now"
echo "to reboot the RPi before starting to configure the system by browsing to rpi_name.local:8086"
hostname
@djdunc
Copy link
Author

djdunc commented Oct 14, 2022

Auto install of TIG stack on RPi4 using 64bit Raspbian for casa0014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment