How to Install Apache ActiveMQ on CentOS 7

Updated on January 25, 2017
How to Install Apache ActiveMQ on CentOS 7 header image

Apache ActiveMQ is a free, open source messaging and integration pattern server which is widely used in enterprise software development.

In this tutorial, I will explain how to install the binary distribution of Apache ActiveMQ on CentOS 7.


  • A fresh Vultr CentOS 7 server instance with the server IP
  • A sudo user.
  • Java 7 or greater.

Step 1: Update the system

Log into your server as a sudo user from an SSH terminal, and then install all available updates using the EPEL YUM repo:

sudo yum install epel-release -y
sudo yum update -y
sudo shutdown -r now

After the system reboot, log back in as the same sudo user.

Step 2: Install OpenJDK JRE 8

Apache ActiveMQ 5.x requires Java 7 or greater. Here, we'll install OpenJDK 8 JRE using YUM:

sudo yum install -y java-1.8.0-openjdk

Then, use the following command to verify the installation result:

java -version

The output should resemble:

openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-b15)
OpenJDK 64-Bit Server VM (build 25.111-b15, mixed mode)

Setup the JAVA_HOME environment variable:

echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
source /etc/profile

Step 3: Install Apache ActiveMQ

You can always get the latest stable release of Apache ActiveMQ from its official release page. At the time of writing this article, the latest release is 5.14.3.

sudo tar -zxvf apache-activemq-5.14.3-bin.tar.gz -C /opt

For your convenience, you can create a version-independent soft link pointing to the directory in which current release of Apache ActiveMQ resides. This practice is helpful for future updates.

sudo ln -s /opt/apache-activemq-5.14.3 /opt/activemq

Step 4: Create a Systemd unit file for Apache ActiveMQ

You can launch Apache ActiveMQ by running its executable file as shown in the following example.

cd /opt/activemq
sudo ./bin/activemq start

However, you may prefer to run ActiveMQ through a Systemd unit file. Create the unit file.

sudo vi /usr/lib/systemd/system/activemq.service

Populate the file with:

Description=activemq message queue
ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop

Save and quit:


With the unit file in place, you can use Systemd to easily start or stop Apache ActiveMQ.

sudo systemctl enable activemq.service
sudo systemctl start activemq.service
sudo systemctl stop activemq.service

Step 5: Access the Apache ActiveMQ web console

When Apache ActiveMQ is running, you can access its web console using your web browser.

Start Apache ActiveMQ:

sudo systemctl start activemq.service

Modify firewall rules in order to allow access to port 8161:

sudo firewall-cmd --zone=public --permanent --add-port=8161/tcp
sudo firewall-cmd --reload

Now, point your web browser to and log in using the default credentials.

  • username: admin
  • password: admin

The username and password can be configured in the /opt/activemq/conf/ file.

Apache ActiveMQ is configured and ready for use. Thanks for reading.