An easy method for installing HiveMQ on Windows OS
This guide provides detailed instructions on how the provided PowerShell script automates the installation of HiveMQ on a Windows operating system. The script simplifies the setup process by handling the download, installation, and configuration of all necessary components. Below, is a break down of each step performed by the script to help you understand what it installs and checks during the execution.
The HiveMQ installation PowerShell script performs the following key actions:
Validates Download Links: Check the availability of all required software download links. The script begins by checking the availability of all required software download links to ensure that all necessary components can be downloaded during the installation process. To facilitate this, your Windows machine must have outbound internet access and be able to reach the following domains:
hivemq.com
: Required for downloading the HiveMQ Broker software.adoptium.net
: Required for downloading the Eclipse Temurin OpenJDK JRE.github.com
: Required for downloading the HiveMQ MQTT CLI.nssm.cc
: Required for downloading the NSSM tool.
Install Java Runtime Environment (JRE): Download and install the appropriate version of Eclipse Temurin OpenJDK JRE. Depending on the HiveMQ version specified, the script determines the appropriate JDK version:
For HiveMQ versions 4.28.0 and above, it installs OpenJDK 21.
For earlier versions, it installs OpenJDK 11.
Install HiveMQ Broker: Download and install the specified version of HiveMQ to the default installation directory
C:\hivemq
.Configure HiveMQ: Creates a basic configuration file for HiveMQ with default settings.
TCP Listener on Port 1883: Allows MQTT clients to connect.
Control Center Listener on Port 8080: Enables access to the HiveMQ Control Center.
Install HiveMQ MQTT CLI: Download and install the executable Windows version of MQTT CLI tool for testing and interaction.
Configure Firewall Rules: Opens necessary ports (1883 and 8080) in Windows Defender Firewall that allow external MQTT clients and users to connect to the broker and control center.
Checks Ports Availability: Verifies that essential ports (1883 and 8080) are open and not in use to ensure that HiveMQ can bind to the required ports without conflicts.
Configure JVM Heap Size: Sets the Java Virtual Machine (JVM) heap size based on available system memory, allocating 50% of available Memory RAM resources to HiveMQ for optimal operation.
Create and Start HiveMQ Service: Sets up HiveMQ to run as a Windows service using NSSM tool to ensure HiveMQ runs continuously in the background and starts automatically with the system.
Instructions for installing HiveMQ on Windows
First, download a PowerShell script that will automate all installation steps in the GitHub repository below.
Download "Install-HiveMQ-WindowsServer-Standalone.ps1" PowerShell Script
Open Windows PowerShell as administrator. Right-click on the Windows PowerShell icon and select “Run as administrator”.
Temporarily sets the current PowerShell session execution policy to Bypass.
Set-ExecutionPolicy Bypass -Scope Process -Force
Navigate to the folder where you downloaded the PowerShell script and execute the
Install-HiveMQ-WindowsServer-Standalone.ps1
script to install HiveMQ and observe the execution output in the terminal.
.\Install-HiveMQ-WindowsServer-Standalone.ps1
Optionally, you can specify parameters -hivemqVersion
and -installationFolder
directly in the command line to specify a different version of HiveMQ or a different installation folder.
.\Install-HiveMQ-WindowsServer-Standalone.ps1 -hivemqVersion "4.32.0" -installationFolder "C:\hivemq"
If HiveMQ is installed successfully, you will see the outputs like the screenshot below.
The next step is to verify if you can access the HiveMQ Control Center in your Windows machine browser at http://localhost:8080. The default username is
admin
and the default password ishivemq
.
Restart your Windows machine. Upon reboot, verify that HiveMQ starts automatically.
At this point, you can Start and Stop the HiveMQ application with its Windows service installed.
TIP: You can display the existing content of hivemq.log
and then continuously update in the console as new lines are added to the file by using the following PowerShell cmdlet.
Instructions for uninstalling HiveMQ on Windows
The uninstall script renames the HiveMQ installation directory instead of deleting it. This allows you to retain any configurations or data you may need later.
First, download a PowerShell script that will automate all installation steps in the GitHub repository below.
Download "Uninstall-HiveMQ-WindowsServer-Standalone.ps1" PowerShell Script
If you are using the default installation folder C:\hivemq
, to uninstall HiveMQ, simply execute the following commands in the PowerShell console.
Temporarily sets the current PowerShell session execution policy to Bypass.
Navigate to the folder where you downloaded the PowerShell script and execute the
Uninstall-HiveMQ-WindowsServer-Standalone.ps1
script to install HiveMQ and observe the execution output in the terminal.
If you are not using the default installation folder C:\hivemq
, specify the parameter -installationFolder
directly in the command line and set the local where HiveMQ installation folder is located in your environment, sample below.
If HiveMQ is uninstalled successfully, you will see the outputs like the screenshot below.