How to Install Apache ActiveMQ on Ubuntu 16.04

Apache ActiveMQ is an free and open source message broker, Developed by: Apache Software Foundation, Written in C, C++, Java, Ruby, Perl, Python, PHP, C#. 

Installing Java

sudo -i

apt-get update

apt-get install default-jdk -y



Get Java version

java -version



You should get output like this.

openjdk version "1.8.0_232"

OpenJDK Runtime Environment (build 1.8.0_232-8u232-b09-0ubuntu1~16.04.1-b09)OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)

Downloading Apache Active-MQ

cd /tmp

wget -c "http://www.apache.org/dyn/closer.cgi?filename=/activemq/5.15.11/apache-activemq-5.15.11-bin.tar.gz&action=download" -O apache-activemq-5.15.11-bin.tar.gz

Extract Apache-activeMQ

tar xzf apache-activemq-5.15.11-bin.tar.gz

Rename the Apache-ActiveMQ

mv apache-activemq-5.15.11 /opt/activemq

We will create user and group named activemq that will be used to run ActiveMQ. Create the group first

groupadd activemq 

Create activemq system user and Updating permission.

useradd -s /bin/false -g activemq -d /opt/activemq activemq

Change ownership of /opt/activemq directory to user activemq and group activemq.

cd /opt/activemq

chown -R activemq:activemq /opt/activemq

chmod -R 775 /opt/activemq

Configure ActiveMQ

cp /opt/activemq/bin/env /etc/default/activemq

Now let’s start configuring ActiveMQ. Open /etc/default/activemq file.

nano /etc/default/activemq

# ACTIVEMQ_HOME="<Installationdir>/"

# ACTIVEMQ_BASE="$ACTIVEMQ_HOME"

# ACTIVEMQ_CONF="$ACTIVEMQ_BASE/conf"

# ACTIVEMQ_DATA="$ACTIVEMQ_BASE/data"

# ACTIVEMQ_TMP="$ACTIVEMQ_BASE/tmp"

Changes to

ACTIVEMQ_HOME="/opt/activemq/"

ACTIVEMQ_BASE="$ACTIVEMQ_HOME"

ACTIVEMQ_CONF="$ACTIVEMQ_BASE/conf"

ACTIVEMQ_DATA="$ACTIVEMQ_BASE/data"

ACTIVEMQ_TMP="$ACTIVEMQ_BASE/tmp"



ACTIVEMQ_USER="activemq"

Copy init script to /etc/init.d using command below:

cp /opt/activemq/bin/activemq /etc/init.d

Change ownership of ActiveMQ init script to user and group root

chmod +x /etc/init.d/activemq

Now let’s start ActiveMQ service using command below:

Controlling ActiveMQ daemon  

To reload Apache ActiveMQ daemon use the following commands

systemctl daemon-reload

To start the  apache tomcat daemon use the following commands

systemctl start activemq

To status the  apache tomcat daemon use the following commands

systemctl status activemq

To stop the  apache tomcat daemon use the following commands

systemctl stop activemq

To enable on boot the apache tomcat daemon use the following commands

systemctl enable activemq

To disable on boot the apache tomcat daemon use the following commands

systemctl disable activemq

Firewall Adjustment

By default, ActiveMQ working on port 8181 for Admin panel, You need to allow ports by following the commands.

ufw allow 8161

Access the ActiveMQ Admin portal

You need to open the browser with

http://your_ip_OR_localhost:8161

Now you need to put the username password, Username and password details are mentioned below :-

Username – admin
Password  – admin



In the end, You will get your ActiveMQ Dashboard.
How to Install Apache ActiveMQ on Ubuntu 16.04

Leave a Reply

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

Scroll to top