We have already described the mosquitto brokers installation in Ubuntu and Debian system, this post is installed mosquitto broker automatically by the simple shell script.
#!/bin/bash
#user add
useradd mosquitto
#Install dependancy packages
sudo apt-get update -y
sudo apt-get install git cmake build-essential python quilt devscripts python-setuptools python3 libssl-dev gdb daemon uuid-dev libc-ares-dev -y
apt-get remove mosquitto -y
#Download mosquitto
wget http://mosquitto.org/files/source/mosquitto-1.4.8.tar.gz
#Extract Mosquitto Package
tar -zxvf mosquitto-1.4.8.tar.gz
cd mosquitto-1.4.8
make
sleep 1
make install
ln -s /usr/local/sbin/mosquitto /usr/sbin/mosquitto
#Start mosquitto
service mosquitto start
#Check your mosquitto port number,
netstat -anp | grep 1883
echo "Now the mosquitto broker is running..."
Create a file with .sh extension and paste the above lines into it.
$ vim mosquitto-install.sh
provide execute permission,
$ chmod +x mosquitto-install.sh
Now, run this file,
/bin/sh mosquitto-install.sh
or
Execute in your current directory
./mosquitto-install.sh
Comments (0)