How to install ActiveMQ on CentOS 8

How To Install Apache ActiveMQ On CentOS 8

On this short tutorial, we will learn how to install ActiveMQ versin 5.16 on CentOS 8 operating system.


If we need a message broker which enable applications to communicate with each other to share information, Apache ActiveMQ could be an options. Apache ActiveMQ is an open source, java based and multi-protocol message broker which is fostering the communication from more than one client or server. ActiveMQ supports industry-standard protocols such as AMQP (Advanced Message Queuing Protocol) to integrate multi-platform applications, STOMP (Simple Text Orientated Messaging Protocol) for exchanging messages between web applications over websockets, and MQTT (Message Queuing Telemetry Transport) to manage IoT devices. On short tutorial, we will learn how to install Apache ActiveMQ on CentOS 8 server.

ActiveMQ Installation on CentOS 8

Apache ActiveMQ is running on Java, so we need Java installed on our CentOS 8 system. For prudent installation, we will have pre-installatin requirements as shown below.

Pre-Installation Requirements

  • Hardware: 60 MB of free disk space for the ActiveMQ binary distribution.
  • Operating Systems: CentOS 8 or any Unix platform that supports Java.
  • Environment: Java Developer Kit (JDK) 1.7.x or greater for deployment and 1.7.x (Java 7) for compiling/building.

Then installation steps will be shown belos :

  1. Install Java
  2. Download Apache ActiveMQ
  3. Create Apache ActiveMQ systemd unit on CentOS 8
  4. Change admin user password
  5. Access Apache ActiveMQ web console

The details of installation will be detail discussed below.

1. Install Java

The first step in installing ActiveMQ is to make sure if our system has Java installed. Java or OpenJDK installation on CentOS 8 has been discussed on How to Install Java (Open JDK 11) on CentOS 8 article.

2. Download Apache ActiveMQ

On this stage, we will download ActiveMQ source file from official Apache ActiveMQ website. By using wget command line, we will download ActiveMQ source file.

$ wget

Output :

[ramans@otodiginet ~]$ wget
--2020-12-11 05:58:39--
Resolving (,,, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: [following]
--2020-12-11 05:58:41--
Resolving (, 2a01:4f8:10a:201a::2
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 62763232 (60M) [application/x-gzip]
Saving to: ‘apache-activemq-5.16.0-bin.tar.gz’

apache-activemq-5.16.0-bin 100%[=======================================>]  59.86M   505KB/s    in 3m 20s  

2020-12-11 06:02:02 (307 KB/s) - ‘apache-activemq-5.16.0-bin.tar.gz’ saved [62763232/62763232]

The file will be located on /tmp directory. By using tar command line, we will extract the downloaded file.

$ tar xvf apache-activemq-5.16.0-bin.tar.gz

Output :

[ramans@otodiginet ~]$ tar xvf apache-activemq-5.16.0-bin.tar.gz

then we will move it to /opt direcotory by submitting command line :

$ sudo mv apache-activemq-*/ /opt/apache-activemq

The file structure of AtiveMQ will be as shown below :

[ramans@otodiginet ~]$ ls -lh /opt/apache-activemq/
total 18M
-rwxr-xr-x. 1 ramans ramans  18M Jun 24 22:49 activemq-all-5.16.0.jar
drwxrwxr-x. 5 ramans ramans  147 Dec 11 06:04 bin
drwxr-xr-x. 2 ramans ramans 4.0K Dec 11 06:04 conf
drwxr-xr-x. 2 ramans ramans   26 Dec 11 06:04 data
drwxr-xr-x. 2 ramans ramans   76 Dec 11 06:04 docs
drwxr-xr-x. 7 ramans ramans   71 Jun 24 23:07 examples
drwxr-xr-x. 6 ramans ramans 4.0K Dec 11 06:04 lib
-rw-r--r--. 1 ramans ramans  40K Jun 24 23:07 LICENSE
-rw-r--r--. 1 ramans ramans 3.3K Jun 24 23:07 NOTICE
-rw-r--r--. 1 ramans ramans 2.6K Jun 24 23:07 README.txt
drwxr-xr-x. 6 ramans ramans   95 Dec 11 06:04 webapps
drwxrwxr-x. 3 ramans ramans   18 Dec 11 06:04 webapps-demo

3. Create Apache ActiveMQ systemd unit on CentOS 8

So far, we have had extracted ActiveMQ application on our system, the next step we will create ActiveMQ system unit to manage ActiveMQ service on the system. To make system unit on CentOS 8, we will need a new user and deploy on it. To do this part, we will do the following steps:

  • Create activemq user
  • Change ownership of ActiveMQ binary
  • Add activemq.service file configuration
  • Reload the service, systemctl daemon-reload

Create activemq user

$ sudo useradd activemq

3.1. Change owndership of ActiveMQ binary

Next, set the correct permissions on the ActiveMQ installation directory and all of its contents belong to the newly created user and group. Besides, confirm that the new permissions are set as follows.

# chown -R activemq:activemq /opt/apache-activemq/

3.2. Add activemq.service file configuration

On this stage, we will create a new file and make it to be a service unit file, as shown below :

# vi /etc/systemd/system/apache-activemq.service

Description=Apache ActiveMQ Messaging Server


ExecStart=/opt/apache-activemq/bin/activemq start
ExecStop=/opt/apache-activemq/bin/activemq stop


3.4. Reload the service

On this stage, we will reload list of Systemd service unit files available by submitting command line :

# systemctl daemon-reload

3.5. Put SELinux in permissive mode

After all are set, then we will put SELinux in permissive mode, by submitting command line :

# setenforce 0
# sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

3.6. Enable and Restart ActiveMQ service

This is the last step on managing ActiveMQ service. We will enable and start ActiveMQ service.

# systemctl enable apache-activemq.service
# systemctl start apache-activemq.service
# systemctl status apache-activemq.service

Output :

[root@otodiginet ~]# setenforce 0
[root@otodiginet ~]# sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
[root@otodiginet ~]# systemctl enable apache-activemq.service
Created symlink /etc/systemd/system/ → /etc/systemd/system/apache-activemq.service.
[root@otodiginet ~]# systemctl start apache-activemq.service
[root@otodiginet ~]# systemctl status apache-activemq.service
● apache-activemq.service - Apache ActiveMQ Messaging Server
   Loaded: loaded (/etc/systemd/system/apache-activemq.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2020-12-11 06:30:01 PST; 6s ago
  Process: 5211 ExecStart=/opt/apache-activemq/bin/activemq start (code=exited, status=0/SUCCESS)
 Main PID: 5282 (java)
    Tasks: 16 (limit: 49605)
   Memory: 89.9M
   CGroup: /system.slice/apache-activemq.service
           └─5282 /usr/bin/java -Xms64M -Xmx1G>

Dec 11 06:30:01 otodiginet systemd[1]: Starting Apache ActiveMQ Messaging Server...
Dec 11 06:30:01 otodiginet activemq[5211]: INFO: Loading '/opt/apache-activemq//bin/env'
Dec 11 06:30:01 otodiginet activemq[5211]: INFO: Using java '/usr/bin/java'
Dec 11 06:30:01 otodiginet activemq[5211]: INFO: Starting - inspect logfiles specified in and log4j.p>
Dec 11 06:30:01 otodiginet activemq[5211]: INFO: pidfile created : '/opt/apache-activemq//data/' (pid'5282')
Dec 11 06:30:01 otodiginet systemd[1]: Started Apache ActiveMQ Messaging Server.

4. Change Password of Admin User

To increase security on ActiveMQ application, we are recommended to change admin user password. The configuration is located at /opt/apache-activemq/conf/ file.

vi /opt/apache-activemq/conf/

## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements.  See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License.  You may obtain a copy of the License at
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------

# Defines users that can access the web (console, demo, etc.)
# username: password [,rolename ...]
admin: admin, admin
user: user, user

On this file, we can define new password for admin and other user password. I have change my ActiveMQ admin password to be :

# username: password [,rolename ...]
admin: OtoAdm1n , admin
user:  Otodigiuser, user

Then we will reload the ActiveMQ service.

# systemctl restart apache-activem

Then we will verify the changes by submitting command line :

# curl --head --user admin:MyAdminPassw0rd http://localhost:8161/admin/xml/topics.jsp

Output :

[root@otodiginet ~]# curl --head --user admin:MyAdminPassw0rd http://localhost:8161/admin/xml/topics.jsp
HTTP/1.1 401 Unauthorized
WWW-Authenticate: basic realm="ActiveMQRealm"
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=iso-8859-1
Content-Length: 466
Server: Jetty(9.4.28.v20200408)
root@otodiginet ~]# curl --head --user admin:MyAdminPassw0rd http://localhost:8161/admin/xml/topics.jsp
HTTP/1.1 200 OK
Date: Fri, Dec 11 06:40:01 GMT
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Set-Cookie: JSESSIONID=node0yqbxi60ra47n1fysq6zgx2lte0.node0; Path=/admin; HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/xml;charset=iso-8859-1
Content-Length: 187
Server: Jetty(9.4.28.v20200408)

The 200 OK message will be displayed if username and password are correct, where 401 Unauthorized message means if user name or password is incorrect.

5. Access Apache ActiveMQ web console

The ActiveMQ web console will be running on port 8161, to acces it we will hit an url of server IP address or hostname of server.

ActiveMQ web console
ActiveMQ web console


On this short tutorial, we have installed Apache ActiveMQ on CentOS 8 operating system. Starting from installing java until accessing ActiveMQ web console. I hope this tutorial will be helpful.

(Visited 156 times, 1 visits today)


No comments yet. Why don’t you start the discussion?

Leave a Reply

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