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

tar -xzvf mosquitto-1.4.7.tar.gz
cd mosquitto-1.4.7

Step 3:

tar xvf c-ares-1.10.0.tar.gz
cd c-ares-1.10.0
sudo make install

Step 4

yum install libuuid-devel

Step 5

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 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


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

$vi /etc/
include /usr/local/lib
$ln -s /usr/local/lib/ /usr/lib/



Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s