General installation information (HiveMQ 3.4)

This documentation is for the HiveMQ 3.4 legacy version. For up-to-date information on the current version of HiveMQ, please switch to the latest version of our HiveMQ Platform documentation and update your bookmarks as needed.

This guide explains the default installation, if you want to try and evaluate HiveMQ without installation you can follow the Getting Started Guide instead.

HiveMQ comes as a zip file which contains the executables, init scripts and sample configurations.

The zip contains the following directories:

Folder name Description

bin

The folder with start scripts and binary files.

conf

The folder with the configurations.

data

Persistent client data and cluster data are located here.

license

The folder where the HiveMQ License file(s) resides.

log

All log files can be found here.

plugins

The folder where plugins reside.

third-party-licenses

Information about the licenses of third party libraries can be found here.

Example configurations
HiveMQ comes with many example configuration files in the conf/examples directory.

Installation on Unix based systems (Linux, BSD, MacOS X, Unix)

The default installation directory is /opt/hivemq and the default user to run HiveMQ is named hivemq. If you need to install HiveMQ to a custom directory or run it under a custom user please be aware of changing the $HIVEMQ_DIRECTORY and/or the HIVEMQ_USER in the $HIVEMQ_DIRECTORY/bin/start.sh script.

  1. Login as root

    Some of the following commands need root privileges, please login as root or use sudo to execute the commands.

  2. Change directory to where you want to download and install HiveMQ. By default we prefer /opt.

    cd /opt
  3. Get your evaluation version from our website.

  4. Copy the provided download link and download HiveMQ

    wget --content-disposition <your download link>

    or

    curl -O -L <your download link>
  5. Extract the files

    unzip hivemq-<version>.zip
  6. Create hivemq symlink

    ln -s /opt/hivemq-<version> /opt/hivemq
  7. Create HiveMQ user

    useradd -d /opt/hivemq hivemq
  8. Make scripts executable and change owner to hivemq user

    chown -R hivemq:hivemq /opt/hivemq-<version>
    chown -R hivemq:hivemq /opt/hivemq
    cd /opt/hivemq
    chmod +x ./bin/run.sh
  9. Adjust the configuration properties to your needs.

    See chapter Configuration for detailed instructions how to configure HiveMQ.

    If you just want to try HiveMQ you can skip this part now and proceed with Starting HiveMQ.

  10. Install the init script (optional)

    For Debian based linux like Debian, Ubuntu, Raspbian using init.d scripts

    cp /opt/hivemq/bin/init-script/hivemq-debian /etc/init.d/hivemq
    chmod +x /etc/init.d/hivemq

    For linux systems using systemd

    cp /opt/hivemq/bin/init-script/hivemq.service /etc/systemd/system/hivemq.service

    For linux systems using systemd and java 9

    cp /opt/hivemq/bin/init-script/hivemq-java9.service /etc/systemd/system/hivemq.service

    For Debian 8 systems using systemd

    wget "http://hivemq.com/releases-all/debian8_systemd.zip"
    unzip debian8_systemd.zip
    cp hivemq.service /opt/hivemq/bin/init-script/hivemq.service
    cp stop_gracefully.sh /opt/hivemq/bin/init-script/stop_gracefully.sh
    chmod +x /opt/hivemq/bin/init-script/stop_gracefully.sh
    cp /opt/hivemq/bin/init-script/hivemq.service /etc/systemd/system/hivemq.service
    rm debian8_systemd.zip
    rm hivemq.service
    rm stop_gracefully.sh

    For all other linux systems

    cp /opt/hivemq/bin/init-script/hivemq /etc/init.d/hivemq
    chmod +x /etc/init.d/hivemq
  11. Modify /etc/init.d/hivemq (optional)

    Set the HIVEMQ_HOME and the HIVEMQ_USER variable to the correct values for your system.

    By default this would be:

    HIVEMQ_HOME=/opt/hivemq

    HIVEMQ_USER=hivemq

    If you installed HiveMQ to a different directory than /opt/hivemq please point the HIVEMQ_HOME in your init script to the correct directory. Otherwise the daemon will not start correctly.

  12. Start HiveMQ on boot (optional)

    For Debian-based linux like Debian, Ubuntu, Raspbian

    update-rc.d hivemq defaults

    For Debian-based linux like Debian, Ubuntu, Raspbian using systemd

    systemctl enable hivemq

    Debian > 6.0

    insserv hivemq

    CentOS or RHEL

    chkconfig hivemq on

Starting HiveMQ

The following instructions show how to start HiveMQ after the installation.

Starting manually

  1. Change directory to HiveMQ directory

    cd /opt/hivemq
  2. Execute startup script

    ./bin/run.sh

Starting as daemon

  1. Start the daemon

    /etc/init.d/hivemq start

Verify if HiveMQ is running

Check if HiveMQ is listening to the default port for MQTT

netstat -an | grep 1883

If you’re running HiveMQ as daemon:

/etc/init.d/hivemq status

Windows systems

Installation

This documentation is for the HiveMQ 3.4 legacy version. For up-to-date information on the current version of HiveMQ, please switch to the latest version of our HiveMQ Platform documentation and update your bookmarks as needed.

Manual installation

  1. Download the latest HiveMQ version from our website

  2. Extract the file hivemq.zip to C:\hivemq using your favorite Zip unpack utility.

Installation as Windows Service

The steps to install HiveMQ as a Windows Service are:

  1. Download the hivemq-windows-service.zip file from here

  2. Unzip the hivemq-windows-service.zip file.

  3. Copy the windows-service folder to your HiveMQ home folder.

  4. Open the windows-service folder.

  5. Double click the installService.bat file.

  6. Reboot

Make sure you have the permission to install a service. Therefore it might be necessary to right click the installService.bat and select Run as administrator.

Starting HiveMQ

The following instructions show how to start HiveMQ after installing:

Double click on the run.bat file.

Please keep in mind that a click with the left mouse button (QuickEdit) stops the output of the command line. When you click the command line before "Started HiveMQT in xxx ms" is displayed, the HiveMQ start up is interrupted and needs to be continued via a click of the right mouse button. A click after the HiveMQ start up has no impact on the execution of HiveMQ.

Verify if HiveMQ is running

Check if HiveMQ is listening to the default port for MQTT.

Open cmd.exe and run:

netstat -an | find "1883"

Installing a HiveMQ license

Installing a HiveMQ license is as simple as moving the hivemq.lic file provided with your purchases into the license folder of your HiveMQ installation.

Licenses can be added during run time and will be automatically and dynamically recognized by HiveMQ.

When a valid license file is found, HiveMQ logs a statement similar to the following:

2018-08-20 20:49:44,322 INFO  - Found valid site license (hivemq.lic) issued to XXX for max XXX connections, valid until XXX.

Multiple license files

A newly obtained license can be added during runtime. When multiple valid license files are recognized by HiveMQ, the license allowing the higher number of concurrent connections will automatically be selected.

In case multiple valid licenses for the same amount of concurrent connections are found HiveMQ will select the license that has a longer validity.

A restart of HiveMQ is not necessary for switching or adding licenses during runtime.

Obtaining a HiveMQ license
If you want to obtain a HiveMQ license, please contact sales@hivemq.com.