This tutorial explains basic steps of installing mosquitto server on openwrt platform. Mosquitto exists in openwrt barrier breaker repository but I decided to crosscompile it. At host computer in openwrt directory call :
uros-petrevski-2:bin uros$ ./scripts/feeds install mosquitto-nossl
This will install version that don’t support ssl layer because we don’t need it. We need server that is fast. Run make menuconfig and under Network select mosquitto nossl as M package.
uros-petrevski-2:bin uros$ make J=4
Then copy mosquitto package to weio. Mosquitto don’t have any dependencies.
uros-petrevski-2:packages uros$ scp /Volumes/openwrt/carambola/bin/ramips/packages/mosquitto-nossl_1.0.3-1_ramips.ipk [email protected]:/tmp
Now it’s time to install mosquitto
root@Weio:/tmp# opkg install mosquitto-nossl_1.0.3-1_ramips.ipk -d root
If you run mosquitto now it will break :
root@Weio:/tmp# mosquitto
11145: Error: Invalid user 'mosquitto'.
The reason is simple, user is not configured. As user is root we have to declare root user un mosquitto configuration. So edit /etc/mosquitto/mosquitto.conf file and add at user section
user root
If you want to run manually mosquitto (you can see what is happening with clients on the console) you have to do :
root@Weio:/# mosquitto -c /etc/mosquitto/mosquitto.conf
Parameter -c specify path to conf file. However if you want to run automaticaly on startup mosquitto server do following
root@Weio:/# /etc/init.d/mosquitto enable
Once system rebooted you can see mosquitto server running by :
root@Weio:/# ps | grep mosquitto
2570 root 932 S /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
2574 root 1488 S grep mosquitto