From 49cefe03350486c82c740f0b3c27c323db526268 Mon Sep 17 00:00:00 2001 From: "olivier.kaufmann" <olivier.kaufmann@umons.ac.be> Date: Sat, 5 Mar 2022 21:02:59 +0100 Subject: [PATCH] Improves local broker installation script --- install_local_mqtt_broker.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/install_local_mqtt_broker.sh b/install_local_mqtt_broker.sh index ef3c8145..f9085ce4 100644 --- a/install_local_mqtt_broker.sh +++ b/install_local_mqtt_broker.sh @@ -1,6 +1,20 @@ +txtred='\e[0;31m' # Red +txtgrn='\e[0;32m' # Green +txtylw='\e[0;33m' # Yellow +txtdef='\e[0;0m' # Default + +echo -e "${txtgrn}>>> Updating system and installing MQTT broker...${txtdef}" sudo apt update && sudo apt upgrade sudo apt install -y mosquitto mosquitto-clients sudo systemctl enable mosquitto.service -echo "Broker is intalled. Starting now..." -mosquitto -v - + +echo -e "\n${txtgrn}>>> Broker is installed. Starting now...${txtdef}" +mosquitto -v + +echo -e "\n${txtgrn}>>> Updating configuration to allow anonymous remote connections...${txtdef}" +echo "listener 1883" | sudo tee -a /etc/mosquitto/mosquitto.conf +echo "allow_anonymous true" | sudo tee -a /etc/mosquitto/mosquitto.conf +echo -e "\n${txtgrn}>>> Current configuration stored in /etc/mosquitto/mosquitto.conf is displayed below${txtdef}" +cat /etc/mosquitto/mosquitto.conf +echo -e "\n${txtylw}>>> Adapt it according to your needs!${txtdef}\n" + -- GitLab