-
Notifications
You must be signed in to change notification settings - Fork 33
/
mqtt.sh
49 lines (41 loc) · 1.17 KB
/
mqtt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
echo "----------------------------------------------------------------"
echo "Setting Up Your Hub W/ MQTT - Ver 1.0"
echo "----------------------------------------------------------------"
echo " "
# System Upgrade
echo " >>>>> Commence System Upgrade <<<<<"
echo " "
sudo apt-get update && sudo apt-get upgrade -y
echo " "
echo ">>>>> System Upgrade Completed <<<<<"
echo " "
# MQTT Upgrade
echo " "
echo " >>>>> Commence MQTT Setup <<<<<"
echo " "
sudo apt-get install mosquitto -y
echo " "
echo " >>>>> Commence Clients Setup <<<<<"
echo " "
sudo apt-get install mosquitto-clients -y
echo " "
echo " >>>>> Create Configuration File <<<<<"
echo " "
cat > /etc/mosquitto/mosquitto.conf <<EOL
# 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 /run/mosquitto/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
allow_anonymous true
listener 1883
EOL
echo " "
echo ">>>>> MQTT Installed <<<<<"
echo " "
echo ">>>>> Restart Hub <<<<<"
sudo reboot