Ubuntu Linux

How to Install Apache ActiveMQ on Ubuntu Linux

Richard
Written by
Richard
Jun 13, 2020 Updated Mar 18, 2026 5 min read

This brief tutorial shows students and new users how to install Apache ActiveMQ on the Ubuntu 20.04 | 18.04 server.

ActiveMQ is available in the classic and the “next generation” Artemis broker. Once Artemis reaches a sufficient level of feature parity with the 5, x codebase, it will become ActiveMQ 6.

Installing Apache ActiveMQ on Ubuntu Linux provides users with a free, high-performance message broker that supports industry-standard protocols for communication between separate applications.

ActiveMQ is a Java-based message broker available in classic and “next generation” Artemis broker versions.

By installing Apache ActiveMQ on Ubuntu Linux, users can take advantage of its powerful features for their applications.

For more about Apache ActiveMQ, please visit its homepage.

When you’re ready to install Apache ActiveMQ, follow the steps below:

Install Java

Apache ActiveMQ is written in Java, so you’ll need Java installed to run it. The open-source Java works great with ActiveMQ. To install the open-source version of Java, run the commands below:

🐧Bash / Shell
sudo apt update
sudo apt-get install default-jre

After installing Java, the commands below can be used to verify whether Java is installed.

💻Code
java -version

You should see a similar output as below:

💻Code
Output:
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04, mixed mode, sharing)

Install Apache ActiveMQ

After installing Java, run the commands below to download ActiveMQ from the Apache Office package repository. At the time of this writing, the current version was 5.15.8.

Command Prompt
cd /tmp
wget http://archive.apache.org/dist/activemq/5.15.8/apache-activemq-5.15.8-bin.tar.gz

After that, extract the downloaded folder, move its content to the /opt directory, and create a folder called activemq

🐧Bash / Shell
tar -xvzf apache-activemq-5.15.8-bin.tar.gz
sudo mv apache-activemq-5.15.8 /opt/activemq

You’ll want to create dedicated user and group accounts to run ActiveMQ effectively. Simply run the commands below to create an ActiveMQ username and a group name.

🐧Bash / Shell
sudo addgroup --quiet --system activemq
sudo adduser --quiet --system --ingroup activemq --no-create-home --disabled-password activemq

Next, change the ownership of the /opt/activemq directory so the user can fully control the content.

🐧Bash / Shell
sudo chown -R activemq:activemq /opt/activemq

After that, you will also want to create an ActiveMQ systemd service so you can control starting, stopping, and enabling its service. To do that, simply run the commands below to create a service file.

🐧Bash / Shell
sudo nano /etc/systemd/system/activemq.service

Then, copy the content below into the file and save it.

💻Code
[Unit]
Description=Apache ActiveMQ
After=network.target
[Service]
Type=forking
User=activemq
Group=activemq

ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop

[Install]
WantedBy=multi-user.target

After saving it, run the commands below to enable the service.

🐧Bash / Shell
sudo systemctl daemon-reload
sudo systemctl start activemq
sudo systemctl enable activemq

To verify if the service is functioning, run the commands below to check it.

💻Code
/opt/activemq/bin/activemq status

You should see a similar output as below:

💻Code
Output:
INFO: Loading '/opt/activemq//bin/env'
INFO: Using java '/usr/bin/java'
ActiveMQ is running (pid '5453')

After installing ActiveMQ, its default configuration file is located at /opt/activemq/conf/activemq.xml. You can open it and modify it to fit your environment.

After making changes to the file, restart the ActiveMQ service by running the commands below:

🐧Bash / Shell
sudo systemctl restart activemq

Finally, open your browser and browse to the server hostname or IP address followed by port #8161

💻Code
http://127.0.0.1:8161/admin/

You should be prompted for a username and password. The default is admin/admin

Username: admin
Password: admin

Log in and begin setting up your

Apache ActiveMQ Ubuntu

That should do it!

You can also use Apache ActiveMQ with Hawtio using the post below:

Conclusion:

  • Apache ActiveMQ is a powerful message broker that enhances communication between applications.
  • The installation process on Ubuntu is straightforward, requiring Java and a few command-line instructions.
  • Users should ensure they configure the activemq.xml file to meet their specific needs.
  • Regular monitoring of the service status is recommended to maintain optimal performance.
  • Access the web interface at http://127.0.0.1:8161/admin/ to manage and monitor your message broker effectively.
  • With the installation complete, users can leverage ActiveMQ’s features to improve application integration and messaging capabilities.

Frequently Asked Questions

What is Apache ActiveMQ?

Apache ActiveMQ is a Java-based message broker that facilitates communication between different applications using industry-standard protocols. It is available in both classic and next-generation Artemis broker versions.

How do I install Java for ActiveMQ on Ubuntu?

To install Java for ActiveMQ on Ubuntu, run the commands 'sudo apt update' followed by 'sudo apt-get install default-jre'. After installation, you can verify it by running 'java -version'.

What commands do I need to download and install ActiveMQ?

To download and install ActiveMQ, navigate to the /tmp directory and use 'wget http://archive.apache.org/dist/activemq/5.15.8/apache-activemq-5.15.8-bin.tar.gz' to download it. Then, extract the files and move them to the /opt directory.

How do I create a systemd service for ActiveMQ?

To create a systemd service for ActiveMQ, create a service file using 'sudo nano /etc/systemd/system/activemq.service' and add the necessary configuration details. This allows you to easily start, stop, and enable the ActiveMQ service.

Why do I need to create a dedicated user for ActiveMQ?

Creating a dedicated user and group for ActiveMQ enhances security and ensures that the service runs with the appropriate permissions. This helps in managing access to the ActiveMQ files and directories effectively.

Was this guide helpful?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version