Hivemq community edition installation in ubuntu using AWS EC2 instance


From last couple of days i am struggling with installation of hivemq in ubuntu using amazon AWS EC2 instance from a windows 10 pc.

After some struggle i was able to install and run it from command line successfully. I still can but. but when i make it to run automatically on startup in ubuntu, it stops responding to its clients. If i check the service status using command “systemctl status hivemq.service” it says service is running. but i cant access.
If i stop the service using command “systemctl stop hivemq.service” and run it again using command “/opt/hivemq/bin/” it starts perfectly and start to work.

Actually when I ssh ubuntu in aws the default user name to login is “ubuntu” (which I cannot change) and all the time I had to run this command “sudo su” to become root user. so when I make it to auto start it must be trying to start under “ubuntu” user. I have no idea how to make root as default user or how can I fix this. if I check the permissions of ubuntu user using command “sudo whoami” it says root. But still I cant get it working. Any ideas how to resolve this problem.

Please help me if you can.

1 Like

Hi @inayyer,

did you follow the installation guide?

The first two lines already state:

The default installation directory for HiveMQ is /opt/hivemq and the default HiveMQ username is hivemq.

If you install HiveMQ to a different directory or define a custom HiveMQ username, you must update the $HIVEMQ_DIRECTORY and HIVEMQ_USER in the $HIVEMQ_DIRECTORY/bin/ script accordingly.

So my guess is that you need to adapt the user in the script (or create a hivemq user).

Hope this helps!

Happy Christmas,

1 Like

Hi Michael,

Thank you very much for your reply. I have finally resolved the issue and its working for me now. I can access it in both ways as mqtt and also by web socket.

Actually I had already created hivemq user. But the problem was the subfolders and few files in hivemq directory were owned by root user. I started looking into log files and found out that one of the file was not accessible because of ownership. So I changed the ownership of each file and subdirectory in hivemq folder to hivemq user and boom. it started working.

I really appreciate your reply. I am thinking about making a video of complete process to help other users. I installed hivemq community edition in ubuntu on AWS EC2 instance. Ill post the link here later.

Best regards,
Imran Nayyer


The above link is no longer working. Can you please post the correct link? Thanks

Hi @sanjmeh,

you’re right, the link directed to the 4.4 version which is not supported anymore (thanks for reporting :slight_smile:).
Here the updated link: General Installation Information :: HiveMQ Documentation


However I find only HiveMQ trial version on the link.
Where is the HiveMQ CE link? I presume HiveMQ CE is different form HiveMQ trial version

Hello @sanjmeh.

Find the latest version of HiveMQ CE here: Release 2021.3 · hivemq/hivemq-community-edition · GitHub.

HiveMQ CE is open source vs the trial version of our enterprise broker offering.

Let us know of any questions!

Best Regards,


I followed all the steps, and after this step I am struggling to proceed, as no matter what I do there are errors.

Could someone advise what are the steps after git clone and the gradle command?

git clone

cd hivemq-community-edition

./gradlew hivemqZip

After the gradle step I got a host of files that got installed in the /opt/hivemq subdirectory.

When I tried to start the hivemq server I get this.

/opt$ systemctl start hivemq
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'hivemq.service'.
Authenticating as: Sanjay Mehrotra,,, (hivemq)
Failed to start hivemq.service: Unit hivemq.service not found.

How can I proceed from here?

Shall I post a fresh question? Does it justify one?

Hello @sanjmeh to confirm the following steps listed here: Installing HiveMQ · hivemq/hivemq-community-edition Wiki · GitHub were carried out? If you are till encountering issues for visibility it makes sense to make a separate thread.


Let me do these steps again and document them, before posting a fresh question. Thanks @edwin

1 Like

You’re welcome @sanjmeh. Let us know of any issues!

My post is hidden, and I don’t know how to make it reappear.

Hello @sanjmeh ,

Please follow the installation steps in General Installation Information :: HiveMQ Documentation and if you run into any issue or have a further question please let us know.

Thank you!
Dasha from HiveMQ team

Thank you for responding.
I followed the steps on the github home page of HiveMQ Community edition. The link you pasted is not for community edition. Isn’t it?

@Daria_H Here is the problem description. If you could be kind enough to advise. Thanks

Hey, @sanjmeh

As far as I can tell from your ports, you are looking at the next section Building from source and you are getting a Gradle error. You do not have to build from source, you can simply unzip the release file.

If you go to GitHub - hivemq/hivemq-community-edition: HiveMQ CE is a Java-based open source MQTT broker that fully supports MQTT 3.x and MQTT 5. It is the foundation of the HiveMQ Enterprise Connectivity and Messaging Platform and scroll down to Quick Start, you see the following instructions:

Quick Start

  • Download the latest HiveMQ CE binary package.
  • Unzip the package.
  • Run the (Linux/OSX) or run.bat (Windows) in the bin folder of the package.

cd hivemq-ce-<version>

When this works (in your first message you indicated that it does), you can continue with the steps from Installing HiveMQ · hivemq/hivemq-community-edition Wiki · GitHub starting from the step 5.

1 Like

Thankyou. I could manage to start the hivemq ce version with above guidance. Now to the next step to configure it. Will close this issue here.

Hi @Daria_H ,

I could manage to cross step 10 successfully from above documentation.

(note: it needed me to make a little changes to the paths, as I installed everything under /root but finally got past successfully step 10).

Now I think there is a mess up as after is run it seems hivemq has started (netstat also shows something listening to port 1883) but when I check the server status or if I try to enable the service it fails.

See the following sequence of comands:

I went ahead to try systemctl start:

hivemq@ubuntu-s-1vcpu-1gb-blr1-01:/etc/systemd/system$ systemctl start hivemq
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'hivemq.service'.
Authenticating as: Sanjay Mehrotra,,, (hivemq)

Then I wanted to see the status of the server but it shows a failed status:

hivemq@ubuntu-s-1vcpu-1gb-blr1-01:/etc/systemd/system$ systemctl status hivemq
● hivemq.service - HiveMQ Community Edition
     Loaded: loaded (/etc/systemd/system/hivemq.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2022-04-20 08:40:39 UTC; 14s ago
    Process: 154285 ExecStart=/opt/hivemq/bin/ (code=exited, status=200/CHDIR)
   Main PID: 154285 (code=exited, status=200/CHDIR)

I tried enabling it by:

hivemq@ubuntu-s-1vcpu-1gb-blr1-01:/etc/systemd/system$ systemctl enable hivemq
Synchronizing state of hivemq.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable hivemq
==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ===
Authentication is required to reload the systemd state.
Authenticating as: Sanjay Mehrotra,,, (hivemq)
update-rc.d: error: hivemq Default-Start contains no runlevels, aborting.

Not sure why I get no runlevels. What does it mean?

Finally I tested using netstat.

hivemq@ubuntu-s-1vcpu-1gb-blr1-01:/etc/systemd/system$ netstat -an | grep 1883
tcp        0      0  *               LISTEN     

Wow it looks to be running. Why does it show failed earlier?

Trying to see jounrnal files:

hivemq@ubuntu-s-1vcpu-1gb-blr1-01:/etc/systemd/system$ journalctl | grep -i hivemq
No journal files were found.

So net net I am confused how to proceed from here. Why does it show a process listening to port 1883 but the server is not yet live.

I ran systemctl list-units and searched for hive and got this line:

hivemq.service  loaded failed failed    HiveMQ Community Edition