adduser mosquitto (Mosquitto wants to run as user mosquitto)
apt-get update
apt-get install build-essential libwrap0-dev libssl-dev libc-ares-dev uuid-dev xsltproc (Install mosquitto dependencies)
cd /home/mosquitto
wget http://mosquitto.org/files/source/mosquitto-1.4.8.tar.gz
tar xvzf mosquitto-1.4.8.tar.gz
cd mosquitto-1.4.8
make
make install
Or Install you can install it in following way
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-wheezy.list
sudo apt-get update
sudo apt-get install mosquitto
sudo stop mosquitto
sudo mosquitto_passwd -c /etc/mosquitto/passwd <user_name>(Create new password file)
sudo gedit /etc/mosquitto/mosquitto.conf (Give the location of the password file to the Mosquitto broker config file)
Add following two lines to config file
password_file /etc/mosquitto/passwd
allow_anonymous false (prevent, clients without username and password connecting to the broker)
mosquitto -c /etc/mosquitto/mosquitto.conf (start broker)
mosquitto_sub -h localhost -p 1883 -t myTopic -u <user_name> -P <password> (verify authentication)
mosquitto_sub -t 'greetings/#' (View published messages live)
apt-get update
apt-get install build-essential libwrap0-dev libssl-dev libc-ares-dev uuid-dev xsltproc (Install mosquitto dependencies)
cd /home/mosquitto
wget http://mosquitto.org/files/source/mosquitto-1.4.8.tar.gz
tar xvzf mosquitto-1.4.8.tar.gz
cd mosquitto-1.4.8
make
make install
Or Install you can install it in following way
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-wheezy.list
sudo apt-get update
sudo apt-get install mosquitto
sudo stop mosquitto
sudo mosquitto_passwd -c /etc/mosquitto/passwd <user_name>(Create new password file)
sudo gedit /etc/mosquitto/mosquitto.conf (Give the location of the password file to the Mosquitto broker config file)
Add following two lines to config file
password_file /etc/mosquitto/passwd
allow_anonymous false (prevent, clients without username and password connecting to the broker)
mosquitto -c /etc/mosquitto/mosquitto.conf (start broker)
mosquitto_sub -h localhost -p 1883 -t myTopic -u <user_name> -P <password> (verify authentication)
mosquitto_sub -t 'greetings/#' (View published messages live)
No comments:
Post a Comment