6th January, 2017 | Tutorials |

How to Install Apache ActiveMQ on Ubuntu 14.04

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.

Get a Cloud Server

ActiveMQ is one of the most popular and powerful open source messaging and integration patterns server.

ActiveMQ Features

Several ActiveMQ features:


In this tutorial we'll learn how-to install and do basic configuration of Apache ActiveMQ and all of its prerequisite on Ubuntu 14.04.


We assume that we have these items before we install Apache ActiveMQ:

Update Base System

Before we install Apache ActiveMQ and its prerequisites let's update the system to the latest update using the following commands:

$ sudo apt-get update
$ sudo apt-get -y upgrade

Install Oracle JDK

Now, let's install Java Development Kit 8. We will use Oracle JDK instead of OpenJDK version of JDK 8.

We'll also use webupd8team ppa repository instead of installing JDK manually. Add webupd8team PPA repository.

$ sudo add-apt-repository ppa:webupd8team/java
 Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA.

More info (and Ubuntu installation instructions): - for Oracle Java 7: - for Oracle Java 8:

Debian installation instructions: - Oracle Java 7: - Oracle Java 8:

Important!!! For now, you should continue to use Java 8 because Oracle Java 9 is available as an early access release (it should be released in 2016)! You should only use Oracle Java 9 if you explicitly need it, because it may contain bugs and it might not include the latest security patches! Also, some Java options were removed in JDK9, so you may encounter issues with various Java apps. More information and installation instructions (Ubuntu / Linux Mint / Debian): More info: Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpaz5gxp9d/secring.gpg' created gpg: keyring `/tmp/tmpaz5gxp9d/pubring.gpg' created gpg: requesting key EEA14886 from hkp server gpg: /tmp/tmpaz5gxp9d/trustdb.gpg: trustdb created gpg: key EEA14886: public key "Launchpad VLC" imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK

Update repository metadata.

$ sudo apt-get update

Install Oracle JDK 8.

$ sudo apt-get -y install oracle-java8-installer

Package configuration. Choose OK.

HP_NO_IMG/data/uploads/users/70fed463-d441-452e-bb7e-e0e3fa684498/1594637328.png" alt="" />

Accepting Oracle Binary Code Lisence Terms. Choose Yes

HP_NO_IMG/data/uploads/users/70fed463-d441-452e-bb7e-e0e3fa684498/1525872870.png" alt="" />

Check Java version by running command below.

$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Install ActiveMQ

Download Apache ActiveMQ from ActiveMQ mirror :

$ wget -c "" -O apache-activemq-5.14.3-bin.tar.gz

Extract downloaded file

$ tar xzf apache-activemq-5.14.3-bin.tar.gz

Rename extracted directory to activemq

$ mv apache-activemq-5.14.3 activemq

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

$ sudo addgroup --quiet --system activemq

Create activemq system user.

$ sudo adduser --quiet --system --ingroup activemq --no-create-home --disabled-password activemq

Modify /etc/passwd entry to change home and group for activemq user.

$ sudo usermod -c "ActiveMQ Broker" -d /opt/activemq -g activemq activemq

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

$ sudo chown -R activemq:activemq /opt/activemq

Change the permission of /opt/activemq directory.

$ sudo chmod u=rwx,g=rxs,o= /opt/activemq

Configure ActiveMQ

Create default file for file by copying bin/env file to /etc/default/activemq.

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

Change the ownership of /etc/default/activemq file to user and group root.

$ sudo chown root:root /etc/default/activemq

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

Find these lines:

# ACTIVEMQ_HOME="<Installationdir>/"

Replace with:


Replace with:


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

$ cd /opt/activemq
$ sudo cp bin/activemq /etc/init.d

Change ownership of ActiveMQ init script to user and group root

$ sudo chown root:root /etc/init.d/activemq

Set activemq to start on boot using update-rc.d

$ sudo update-rc.d activemq defaults

Now let's start ActiveMQ service using command below:

$ sudo service activemq start

ActiveMQ will show some output regarding the startup process:

INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in and to get details
INFO: changing to user 'activemq' to invoke java
INFO: pidfile created : '/opt/activemq/data/' (pid '22291')

To check whether ActiveMQ is already running or not we can use command below:

$ sudo service activemq status
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
ActiveMQ is running (pid '22291')

We can also use ps to check whether ActiveMQ process is running or not.

$ ps aux | grep activemq
activemq 22516  108  7.9 2962096 80584 ?       Sl   09:14   0:03 /usr/bin/java -Xms64M -Xmx1G -Djava.awt.headless=true -Dactivemq.classpath=/opt/activemq/conf:/etc//../lib/: -Dactivemq.home=/opt/activemq -Dactivemq.base=/opt/activemq -Dactivemq.conf=/opt/activemq/conf -jar /opt/activemq/bin/activemq.jar start

ActiveMQ default port is 61616 we can use netstat to check if ActiveMQ already listen on that port.

$ sudo netstat -naptu | grep 61616
tcp6       0      0 :::61616                :::*                    LISTEN      22516/java 

ActiveMQ also has a web console that listens on port 8161 we can also check using netstat to check if ActiveMQ is already listening on that port:

$ sudo netstat -naptu | grep 8161
tcp6       0      0 :::8161                 :::*                    LISTEN      22516/java  

Accessing ActiveMQ Web Admin

To access the web admin we can point our browser to http://activemq-ipaddress:8161/admin

It will prompt authentication form. Input admin as default username and password.

HP_NO_IMG/data/uploads/users/7d0b29d6-eaf0-48d0-84b2-e1e14356af78/1382898690.png" alt="" />

From this web admin we can manage and monitor our ActiveMQ installation.

HP_NO_IMG/data/uploads/users/7d0b29d6-eaf0-48d0-84b2-e1e14356af78/15008667.png" alt="" />

Monitoring ActiveMQ With

Beside using ActiveMQ default web admin we can also monitor our ActiveMQ installation using but we need to install Hawtio first.

We can download the latest version of from Getting Stated Page.

Let's download offline .war using wget

$ wget -c

Unzip downloaded .war:

$ unzip hawtio-default-offline-1.4.67.war -d hawtio

Move extracted war to webapps directory:

$ sudo mv hawtio /opt/activemq/webapps

We need to change ACTIVEMQ_OPTS to add hawtio options. Open /etc/default/activemq

Find the line:


Replace with:

ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY$ACTIVEMQ_CONF/login.config -Dhawtio.realm=activemq -Dhawtio.role=admins -Dhawtio.rolePrincipalClasses=org.apache.activemq.jaas.GroupPrincipal"

Open /opt/activemq/conf/jetty.xml, find line:

<ref bean="rewriteHandler"/>

Add these line below the line.

<bean class="org.eclipse.jetty.webapp.WebAppContext">
    <property name="contextPath" value="/hawtio" />
    <property name="resourceBase" value="${activemq.home}/webapps/hawtio" />
    <property name="logUrlOnStart" value="true" />

Now restart ActiveMQ process

$ sudo service activemq restart

Now point our browser to http://activemq-ipaddress:8161/hawtio. Login using admin as username and password.

HP_NO_IMG/data/uploads/users/7d0b29d6-eaf0-48d0-84b2-e1e14356af78/386616084.png" alt="" />

Hawtio Welcome Page HP_NO_IMG/data/uploads/users/7d0b29d6-eaf0-48d0-84b2-e1e14356af78/1150081362.png" alt="" />

Hawtio ActiveMQ dashboard.

HP_NO_IMG/data/uploads/users/7d0b29d6-eaf0-48d0-84b2-e1e14356af78/1191669204.png" alt="" />


In this tutorial we learned how-to install ActiveMQ on Ubuntu 14.04. We also learned accessing ActiveMQ web admin and installing Hawtio as alternative web admin for ActiveMQ.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.

Get a Cloud Server