# Hivemq community edition installation in ubuntu using AWS EC2 instance

**URL:** https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409
**Category:** HiveMQ Community Edition
**Created:** [December 26, 2020, 5:51pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409 "2020-12-26T17:51:03Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![inayyer](https://avatars.discourse-cdn.com/v4/letter/i/e36b37/32.png) [@inayyer](https://community.hivemq.com/u/inayyer)
#### Post date: [December 26, 2020, 5:51pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/1 "2020-12-26T17:51:03Z")

</div>

Hi,

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/run.sh” 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.

---

<div class="post-metadata">

### Author: ![michael\_w](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/michael_w/32/200_2.png) [@michael\_w](https://community.hivemq.com/u/michael_w)
#### Post date: [December 27, 2020, 6:35pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/2 "2020-12-27T18:35:10Z")

</div>

Hi @inayyer,

did you follow the installation guide?

> **[General Installation Information :: HiveMQ Documentation](https://www.hivemq.com/docs/hivemq/4.4/user-guide/install-hivemq.html#linux)**

The first two lines already state:

```auto
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/start.sh 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,  
Michael

---

<div class="post-metadata">

### Author: ![inayyer](https://avatars.discourse-cdn.com/v4/letter/i/e36b37/32.png) [@inayyer](https://community.hivemq.com/u/inayyer)
#### Post date: [December 28, 2020, 8:46pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/3 "2020-12-28T20:46:06Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [March 26, 2022, 9:26am UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/4 "2022-03-26T09:26:09Z")

</div>

> [@michael\_w](#):
>
> General Installation Information :: HiveMQ Documentation

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

---

<div class="post-metadata">

### Author: ![michael\_w](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/michael_w/32/200_2.png) [@michael\_w](https://community.hivemq.com/u/michael_w)
#### Post date: [March 28, 2022, 7:32am UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/5 "2022-03-28T07:32:44Z")

</div>

Hi @sanjmeh,

you’re right, the link directed to the 4.4 version which is not supported anymore (thanks for reporting 🙂).  
Here the updated link: [General Installation Information :: HiveMQ Documentation](https://www.hivemq.com/docs/hivemq/latest/user-guide/install-hivemq.html#linux)

Greetings,  
Michael

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [March 28, 2022, 5:17pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/6 "2022-03-28T17:17:05Z")

</div>

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

---

<div class="post-metadata">

### Author: ![edwin](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@edwin](https://community.hivemq.com/u/edwin)
#### Post date: [March 28, 2022, 5:56pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/7 "2022-03-28T17:56:36Z")

</div>

Hello @sanjmeh.

Find the latest version of HiveMQ CE here: [Release 2021.3 · hivemq/hivemq-community-edition · GitHub](https://github.com/hivemq/hivemq-community-edition/releases/tag/2021.3).

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

Let us know of any questions!

Best Regards,  
Edwin

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [March 28, 2022, 8:09pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/8 "2022-03-28T20:09:45Z")

</div>

Thanks.

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?

```auto
git clone https://github.com/hivemq/hivemq-community-edition.git

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.

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

```

How can I proceed from here?

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [March 29, 2022, 10:57am UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/9 "2022-03-29T10:57:00Z")

</div>

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

---

<div class="post-metadata">

### Author: ![edwin](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@edwin](https://community.hivemq.com/u/edwin)
#### Post date: [March 30, 2022, 1:46am UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/10 "2022-03-30T01:46:03Z")

</div>

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

Cheers,  
Edwin

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [March 31, 2022, 5:01pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/11 "2022-03-31T17:01:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![edwin](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@edwin](https://community.hivemq.com/u/edwin)
#### Post date: [March 31, 2022, 5:59pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/12 "2022-03-31T17:59:38Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [April 18, 2022, 8:43am UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/15 "2022-04-18T08:43:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)
#### Post date: [April 19, 2022, 8:38am UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/16 "2022-04-19T08:38:16Z")

</div>

Hello @sanjmeh ,

Please follow the installation steps in [General Installation Information :: HiveMQ Documentation](https://www.hivemq.com/docs/hivemq/4.7/user-guide/install-hivemq.html) and if you run into any issue or have a further question please let us know.

Thank you!  
Dasha from HiveMQ team

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [April 19, 2022, 1:05pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/17 "2022-04-19T13:05:11Z")

</div>

Thank you for responding.  
I followed the steps on the [github home page](https://github.com/hivemq/hivemq-community-edition/wiki/Installing-HiveMQ) of HiveMQ Community edition. The link you pasted is not for community edition. Isn’t it?

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [April 19, 2022, 1:26pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/18 "2022-04-19T13:26:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)
#### Post date: [April 19, 2022, 3:11pm UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/19 "2022-04-19T15:11:46Z")

</div>

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](https://github.com/hivemq/hivemq-community-edition) and scroll down to **Quick Start** , you see the following instructions:

> ### Quick Start
> 
> - Download the latest [HiveMQ CE binary package](https://github.com/hivemq/hivemq-community-edition/releases/download/2021.3/hivemq-ce-2021.3.zip).
> - Unzip the package.
> - Run the `run.sh` (Linux/OSX) or run.bat (Windows) in the bin folder of the package.
> 
> `cd hivemq-ce-<version> `  
> `bin/run.sh`

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](https://github.com/hivemq/hivemq-community-edition/wiki/Installing-HiveMQ#installation-on-unix-based-systems-linux-bsd-macos-x-unix) starting from the step 5.

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [April 20, 2022, 7:35am UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/20 "2022-04-20T07:35:29Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [April 20, 2022, 9:01am UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/21 "2022-04-20T09:01:14Z")

</div>

Hi @Daria_H ,

> [@Daria\_H](#):
>
> 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](https://github.com/hivemq/hivemq-community-edition/wiki/Installing-HiveMQ#installation-on-unix-based-systems-linux-bsd-macos-x-unix) starting from the step 5.

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 run.sh 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`:

```auto
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)
Password: 
==== AUTHENTICATION COMPLETE ===
hivemq@ubuntu-s-1vcpu-1gb-blr1-01:/etc/systemd/system$ 

```

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

```auto
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/run.sh (code=exited, status=200/CHDIR)
   Main PID: 154285 (code=exited, status=200/CHDIR)

```

I tried enabling it by:

```auto
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)
Password: 
==== AUTHENTICATION COMPLETE ===
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.

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

```

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

Trying to see jounrnal files:

```auto
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.

---

<div class="post-metadata">

### Author: ![sanjmeh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/sanjmeh/32/305_2.png) [@sanjmeh](https://community.hivemq.com/u/sanjmeh)
#### Post date: [April 23, 2022, 1:46am UTC](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409/22 "2022-04-23T01:46:51Z")

</div>

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

```auto
hivemq.service loaded failed failed HiveMQ Community Edition            

```

[Next page](https://community.hivemq.com/t/hivemq-community-edition-installation-in-ubuntu-using-aws-ec2-instance/409.md?page=2)
