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.
1 |
http://mirror.downloadvn.com/apache/activemq/5.15.0/apache-activemq-5.15.0-bin.tar.gz |
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/
1 |
sudo tar -xf apache-activemq-5.15.0-bin.tar.gz -C /opt/ |
3.3. Start ActiveMQ
To start ActiveMQ in the foreground:
1 |
sudo /opt/apache-activemq-5.15.0/bin/activemq console |
To start ActiveMQ in the background:
1 |
sudo /opt/apache-activemq-5.15.0/bin/activemq start |
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:
- URL: http://127.0.0.1:8161/admin/
- Username: admin
- Password: admin

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:
1 |
Apache ActiveMQ 5.15.0 (localhost, ID:vagrant-42941-1502292036715-0:1) started |
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:
1 |
netstat -nl|grep 61616 |
The output of the command will be as follows:
1 2 |
vagrant@vagrant:~$ netstat -nl|grep 61616 tcp6 0 0 :::61616 :::* LISTEN |
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:
1 |
sudo /opt/apache-activemq-5.15.0/bin/activemq stop |
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:
1 2 |
sudo apt-get update sudo apt-get install activemq |
To start ActiveMQ, we can run the command:
1 |
sudo systemctl start activemq |
To check for its status:
1 |
systemctl status activemq |
The output can be similar to:
1 2 3 4 5 6 |
● activemq.service - LSB: ActiveMQ instance Loaded: loaded (/etc/init.d/activemq; bad; vendor preset: enabled) Active: active (exited) since Sat 2017-08-19 14:15:12 UTC; 33s ago Docs: man:systemd-sysv-generator(8) Process: 3876 ExecStop=/etc/init.d/activemq stop (code=exited, status=0/SUCCESS) Process: 3903 ExecStart=/etc/init.d/activemq start (code=exited, status=0/SUCCESS) |
To stop the ActiveMQ
1 |
sudo systemctl stop 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.