How To Install ActiveMQ on Ubuntu 16.04 LTS (Xenial Xerus)

1. Introduction

Apache ActiveMQ is a popular and powerful open source messaging and Integration Patterns server. In this guide, we’re going to install ActiveMQ on Ubuntu 16.04.

2. Prerequisites

  • Java 1.7 or later.
  • The JAVA_HOME environment variable is set correctly.

3. Install ActiveMQ on Ubuntu 16.04 Manually

3.1. Download the ActiveMQ

We can download the ActiveMQ zipped tarball file from ActiveMQ website, using either a browser or a tool, i.e., wget, SCP, FTP, etc. For example, the following command will download ActiveMQ version 5.15.0.

3.2. Extract the files from the zipped tarball into a directory of your choice.

For example, the following command will extract the downloaded file into /opt/apache-activemq-5.15.0/

3.3. Start ActiveMQ

To start ActiveMQ in the foreground:

To start ActiveMQ in the background:

3.4. Verify the Installation

We can verify the installation by different ways:

3.4.1. Use the Administrative Interface

We can open the administrative interface with information as follows:

install ActiveMQ on Ubuntu 16.04 - ActiveMQ Admin Interface

ActiveMQ Admin Interface

3.4.2. Use Logfile and Console Output

The ActiveMQ’s log file can be found at: /opt/apache-activemq-5.15.0/data/activemq.log

If ActiveMQ is started successfully, the command shell and the log file will have information similarly to the following log line:

3.4.3. Use Listening Port

ActiveMQ’s default port is 61616 on which we can use the netstat command to check if ActiveMQ already listen:

The output of the command will be as follows:

3.4. Stop ActiveMQ

If we start ActiveMQ in the foreground, we can terminate ActiveMQ by typing “CTRL-C” in the console or command shell in which it is running.

If ActiveMQ was started in the background, we can stop it by running the below command:

4. Install ActiveMQ on Ubuntu 16.04 Using apt-get

Another option for us to install ActiveMQ on Ubuntu is to use apt-get. However, with this option, we can only install the versions available on the repository which may not our desired version. To install ActiveMQ, we can issue the following commands on the terminal:

To start ActiveMQ, we can run the command:

To check for its status:

The output can be similar to:

To stop the ActiveMQ

5. Conclusions

The tutorial has just covered how to install ActiveMQ on Ubuntu 16.04 (Xenial Xerus) by manually or by using apt-get. With the first way, we can download and install our desired version while the second one allows us to install it quickly with versions supported from repositories.