Skip to content

Instantly share code, notes, and snippets.

@boseji
Last active April 16, 2017 12:18
Show Gist options
  • Save boseji/bebb504a4de06b26de8c1d14f3885796 to your computer and use it in GitHub Desktop.
Save boseji/bebb504a4de06b26de8c1d14f3885796 to your computer and use it in GitHub Desktop.
MosquitoInstall
#!/bin/bash
# Raspberry Pi Mosquito Install Script
sudo wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/
sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list
cd
sudo apt-get update
rm mosquitto-repo.gpg.key
sudo apt-get install -y python-pip mosquitto mosquitto-clients python-mosquitto
sudo /etc/init.d/mosquitto stop
txt = "
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest topic
#log_dest file /var/log/mosquitto/mosquitto.log
log_type error
log_type warning
log_type notice
log_type information
connection_messages true
log_timestamp true
include_dir /etc/mosquitto/conf.d
"
sudo echo $text > /etc/mosquitto/mosquitto.conf
# Restart Mosquito Service
sudo systemctl restart mosquitto
# Install Python PAHO Client
sudo pip install paho-mqtt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment