How to Install Apache ActiveMQ on Ubuntu 18.04 | 16.04

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

For those who don’t know, Apache ActiveMQ is a free, multi-protocol, Java-based message broker software written in Java. It supports industry standard protocols that allows communication between separate applications.

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 code-base it will become ActiveMQ 6.

If you’re looking for a free, high performance message broker for your applications, you may want to try Apache ActiveMQ.

For more about Apache ActiveMQ, please visit its homepage.

If you’re a student or new user looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS…. It’s a great Linux operating system for beginners and folks looking for easier Linux distribution to use..

Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other devices…

When using Ubuntu, you will find that Linux isn’t so different than Windows and other operating systems in so many ways, especially when it comes to using the system to get work done.…

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

Step 1: Install Java

Apache ActiveMQ is written in the 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:

sudo apt update
sudo apt-get install default-jre

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

java -version

You should see similar output as below:

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)

Step 2: Install Apache ActiveMQ

Now that Java is installed, run the commands below to download ActiveMQ from Apache office package repository. At the time of this writing, the current version was at 5.15.8.

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 and move its content to the /opt directory and create a folder called activemq

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

To run ActiveMQ effectively, you’ll want to create a dedicated user and group accounts.. Simply run the commands below to create a username activemq as well as a group name.

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 have full control of content in there.

sudo chown -R activemq:activemq /opt/activemq

After that, you will also want to create 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.

sudo nano /etc/systemd/system/activemq.service

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

[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.

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.

/opt/activemq/bin/activemq status

You should see similar output as below:

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 location at /opt/activemq/conf/activemq.xml. You can open it and modify it to fit your environment.

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

sudo systemctl restart activemq

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

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

Login and begin setting up your

Apache ActiveMQ Ubuntu

That should do it!

Conclusion:

This post shows you how to install Apache ActiveMQ on Ubuntu 18.04 | 16.04. If you find any errors above, please use the comment form below to report them.

You may also like the post below:

How to Install Mono on Ubuntu 18.04 | 16.04

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.