Skip to content

Instantly share code, notes, and snippets.

@marians
Last active January 7, 2021 08:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marians/60a6b1492692aa4d0e91be71957e3766 to your computer and use it in GitHub Desktop.
Save marians/60a6b1492692aa4d0e91be71957e3766 to your computer and use it in GitHub Desktop.
Notes on my Raspberry Pi setup

I'm setting up a Raspberry Pi 3 Model B as a server mainly for sensors in my home.

Base system

  • Raspbian GNU/Linux 8 (jessie)
  • timezone UTC

Wifi

See https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md

sudo iwlist wlan0 scan

wpa_passphrase "My-Network-SSID"

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

sudo wpa_cli reconfigure

Logging

After https://hallard.me/raspberry-pi-read-only/

# Remove logrotate
apt-get remove --purge logrotate

# swap syslogd
apt-get install busybox-syslogd
dpkg --purge rsyslog

Logs will be ephemeral this way. Use logread to access system logs.

Mosquitto MQTT Broker

sudo apt-get install mosquitto

Edit /etc/mosquitto/mosquitto.conf:

pid_file /var/run/mosquitto.pid
persistence false
log_dest none
include_dir /etc/mosquitto/conf.d
sudo service mosquitto start

InfluxDB

  • Data should be written to a ramdisk
  • regularly backed up to S3
# install influxdb
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update && sudo apt-get install influxdb

# create ramdisk
sudo chmod 777 /var/lib/influxdb
sudo mount -t tmpfs none /var/lib/influxdb

# add this line to /etc/fstab:
tmpfs    /var/lib/influxdb    tmpfs    defaults    0    0

# start
sudo service influxdb start

Grafana

Installing Go:

wget https://storage.googleapis.com/golang/go1.8.1.linux-armv6l.tar.gz
tar xzf go1.8.1.linux-armv6l.tar.gz
sudo mv ./go /usr/local/
sudo chmod g+w,o+w /tmp


wget https://github.com/grafana/grafana/archive/v4.2.0.tar.gz
tar xvzf v4.2.0.tar.gz && rm v4.2.0.tar.gz

Node Red

sudo apt-get install npm nodered
sudo service nodered start

Connect via http://raspberrypi.local:1880/

telegraf

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