Skip to content

Instantly share code, notes, and snippets.

@ItKindaWorks
Last active July 18, 2021 23:59
Show Gist options
  • Save ItKindaWorks/c88b6278bcb797e6db1b59c5823dfa7f to your computer and use it in GitHub Desktop.
Save ItKindaWorks/c88b6278bcb797e6db1b59c5823dfa7f to your computer and use it in GitHub Desktop.
installer script to install grafana and influxdb for ubuntu 18.04
#install tools needed for influx installation
sudo apt-get install -y curl net-tools openssh-server python-pip
pip install paho-mqtt
pip install influxdb
echo
echo "Setting up InfluxDB for installation..."
echo
sleep 5
#add influx to list of allowed software
echo "deb https://repos.influxdata.com/ubuntu bionic stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
echo
echo "Installing InfluxDB..."
echo
sleep 5
#install influxdb & start
sudo apt-get update && sudo apt-get install influxdb
sudo service influxdb start
echo
echo "Setting up Grafana for installation..."
echo
sleep 5
#install tools needed for grafana install
sudo apt-get install -y software-properties-common
#add grafana to list of allowed software
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo
echo "Installing Grafana..."
echo
sleep 5
#install an start grafana
sudo apt-get update && sudo apt-get install grafana
sudo systemctl enable grafana-server.service
sudo systemctl start grafana-server
echo
echo "Going into InfluxDB console for setup..."
echo
sleep 5
#run influx db and setup a new database (and add some dummy data)
influx
#CREATE DATABASE smartHome
#SHOW DATABASES
#USE smartHome
#INSERT cpu,host=serverA value=0.64
#SELECT * from cpu
#exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment