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.

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

1 Like