Linux · MQTT

Build Mosquitto on Centos

Step 1

yum install gcc-c++
yum install cmake
yum install openssl-devel //mosquitto  are supported by default openssl

Step 2

wget http://mosquitto.org/files/source/mosquitto-1.4.7.tar.gz
tar -xzvf mosquitto-1.4.7.tar.gz
cd mosquitto-1.4.7

Step 3:

wget http://c-ares.haxx.se/download/c-ares-1.10.0.tar.gz
tar xvf c-ares-1.10.0.tar.gz
cd c-ares-1.10.0
./configure
make
sudo make install

Step 4

yum install libuuid-devel

Step 5

wget https://github.com/warmcat/libwebsockets/archive/v1.3-chrome37-firefox30.tar.gz
tar zxvf v1.3-chrome37-firefox30.tar.gz
cd libwebsockets-1.3-chrome37-firefox30
mkdir build; cd build;
cmake .. -DLIB_SUFFIX=64
make install

Step 6

make
make install

Here are default intall path.

path files
/usr/local/sbin mosquiotto server
/etc/mosquitto configuration
/usr/local/bin utility command

Step 7: Sample configuration file will be installed in /etc/mosquitto/mosquitto.conf.example. Change file name to be official.

mv /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf

Step 8: Create user. Mosquitto default to mosquitto User initiated, can through a configuration file and modify

groupadd mosquitto
useradd -g mosuqitto mosquiotto

Step 9: Start Mosquitto

Mosquitto

Step 10: Fix error: mosquitto_pub: error while loading shared libraries: libmosquitto.so.1: cannot open shared object file: No such file or directory

$vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
include /usr/local/lib
/usr/lib
/usr/local/lib
$/sbin/ldconfig
$ln -s /usr/local/lib/libmosquitto.so.1 /usr/lib/libmosquitto.so.1

Source: http://qiita.com/aquaviter/items/cb3051cf42a3a3c4a4d9
http://www.codes9.com/design-and-manage/architecture/mqtt-mosquitto1-4-4-server-installation-guide/
http://stackoverflow.com/questions/30861974/mosquitto-pub-error-while-loading-shared-libraries-libmosquitto-so-1-cannot-o

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s