Requirements
- Ubuntu 12.04LTS
- Install path is /opt/hivemq (linked from /opt/hivemq-{version})
Installation
Install JDK
$ sudo add-apt-repository ppa:dlecan/openjdk
$ sudo apt-get update
$ apt-get install openjdk-7-jdk
Install HiveMQ
HiveMQ documentation is helpful to install HiveMQ. Please refer it as well.
http://www.hivemq.com/docs/hivemq/1.4.1/
$ cd /opt
$ wget --content-disposition http://www.hivemq.com/downloads/releases/latest
$ unzip hivemq-{version}.zip
$ ln -s hivemq-{version} hivemq
Create HiveMQ user
$ sudo useradd -d /opt/hivemq hivemq
Make scripts executable and change owner to hivemq user
$ sudo chown -R hivemq.hivemq /opt/hivemq-{version}
$ sudo chown -R hivemq.hivemq /opt/hivemq
$ cd /opt/hivemq
$ sudo chmod +x ./bin/run.sh
Register starup
$ sudo cp /opt/hivemq/bin/init-script/hivemq /etc/init.d/hivemq
$ sudo chmod -x /etc/init.d/hivemq
$ sudo update-rc.d hivemq defaults
Starting HiveMQ
$ sudo service hivemq start
If you see any errors at starting hivemq, please start with /opt/hivemq/bin/run.sh
as debug.
Install Plugin
Download plugins from here. http://www.hivemq.com/plugins/
All plugins described on the web page is just located in /opt/hivemq/plugins
Configuration
Configuration file is located in /opt/hivemq/conf directory.
SSL/TLS
Please refer http://www.hivemq.com/docs/hivemq/1.4.1/#hivemqdocs_ssl_tls as well.
http://mosquitto.org/man/mosquitto-tls-7.html is also helpful.
Edit configuration file.
ssl.enable=ture
ssl.port=8883
ssl.protocol=TLS
keystore.location=/opt/hivemq/conf/certs/server.key
keystore.password={password}
truststore.location=/opt/hivemq/conf/certs/ca.cert
truststore.password={password}
ssl.clientAuthenticationMode=none
ssl.handshakeTimeout=0
ssl.hybridMode=true
Generate a certificate authority certificate and key.
$ openssl req -new -x509 -days 1024 -extensions v3_ca -keyout ca.key -out ca.crt
Generate a server key, sign requests to send to the CA, send the CSR to the CA.
$ openssl genrsa -des3 -out server.key 2048
$ openssl req -out server.csr -key server.key -new
$ openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out
server.crt -days 1024
Copy key and cert file.
$ sudo cp server.key ca.crt /opt/hivemq/conf/certs
Restart HiveMQ.
And here is a command creating client certification. Please enter the command on CA server.
$ openssl genrsa -des3 -out client.key 2048
$ openssl req -out client.csr -key client.key -new
$ openssl x509 -req in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out client.crt -days 1024