How to Install Apache ActiveMQ on CentOS/RHEL 8

ActiveMQ is a popular, open-source, multi-protocol implementation of message-oriented middleware (MOM) with enterprise features written in Java, used to send messages between two applications, or two components inside an application.

It supports a wide range of Cross-Language Clients from Java, C, C++, C#, Ruby, Perl, Python, PHP, and transport protocols such as OpenWire, STOMP, MQTT, AMQP, REST, and WebSockets.

Read Also: How to Install Apache ActiveMQ on Debian 10

Some of its use cases include transactional messaging, clustering and general-purpose async messaging model, web streaming of data, RESTful API to messaging using HTTP, and much more.

In this article, we will explain to you how to install the latest version of Apache ActiveMQ on CentOS 8 and RHEL 8 Linux distribution.

Installing Apache ActiveMQ on CentOS and RHEL 8

To install ActiveMQ, your system must have Java installed on your server. If Java is not installed, you can install it on your system using our How to Install Java on CentOS and RHEL 8 guide.

Once Java installed, you can proceed further to download the latest version of ActiveMQ or use the following wget command to grab the source package as shown.

# cd /opt
# wget https://www.apache.org/dist/activemq/5.15.10/apache-activemq-5.15.10-bin.tar.gz

Now extract the archive file using tar command and move into the extracted directory using cd command as shown.

# tar zxvf apache-activemq-5.15.10-bin.tar.gz
# cd apache-activemq-5.15.10

Now your ActiveMQ package should be installed in the /opt/apache-activemq-5.15.9 directory and you can view its contents using the ls command.

# ls -l 
ActiveMQ Files
ActiveMQ Files

From the output above, there are some key directories you need to take note of, they include the following:

  • bin – stores the binary file plus other related files.
  • conf – contains the configuration files: the main configuration file activemq.xml, written in XML format.
  • data – stores the PID file as well as log files.
  • docs – contains documentation files.
  • lib – stores library files.
  • webapps – contains the web interface and admin console files.

Running ActiveMQ as a Service Under Systemd

To run ActiveMQ as a service, you need to create an ActiveMQ service unit file under the user called activemq, so start by creating the user using useradd command as shown.

# useradd activemq

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-5.15.10
# ls -l /opt/apache-activemq-5.15.10/
Setting Permissions on ActiveMQ
Setting Permissions on ActiveMQ

Now create a service unit file for ActiveMQ called activemq.service under /etc/systemd/system/ directory.

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

Add the following configuration in the activemq.service file.

[Unit]
Description=Apache ActiveMQ Message Broker
After=network-online.target

[Service]
Type=forking

User=activemq
Group=activemq

WorkingDirectory=/opt/apache-activemq-5.15.10/bin
ExecStart=/opt/apache-activemq-5.15.10/bin/activemq start
ExecStop=/opt/apache-activemq-5.15.10/bin/activemq stop
Restart=on-abort


[Install]
WantedBy=multi-user.target

Save the file and close it. Then reload the systemd manager configuration to read the newly created service, using the following command.

# systemctl daemon-reload
Create ActiveMQ Service Unit File
Create ActiveMQ Service Unit File

Next, you can use the systemctl commands to start. enable and check the status of Apache ActiveMQ service as shown.

# systemctl start activemq.service
# systemctl enable activemq.service
# systemctl status activemq.service
Start ActiveMQ Service
Start ActiveMQ Service

By default, the ActiveMQ daemon listens on port 61616 and you can confirm the port using the ss utility as follows.

# ss -ltpn 
Check ActiveMQ Port
Check ActiveMQ Port

Before you can access the ActiveMQ web console, if you have the firewalld service running (which should be by default), you need to open the port 8161 which the web console listens on in the firewall, using the firewall-cmd tool as shown.

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

Testing the ActiveMQ Installation

The ActiveMQ web console is used to manage and monitor ActiveMQ via a web browser. To access it open a web browser and point it to the following URL:

http://localhost:8161
OR
http://SERVER_IP:8161

You will land on the following web interface.

ActiveMQ Web Console
ActiveMQ Web Console

To start the actual administration of ActiveMQ, log into the admin web console by clicking on the “Manager ActiveMQ broker” link. Alternatively, the following URL will also take you directly to the admin web console login interface.

http://localhost:8161/admin 
OR
http://SERVER_IP:8161/admin

Then use the default username admin and password admin to log in.

ActiveMQ Admin Login
ActiveMQ Admin Login

The following screenshot shows the web console dashboard, with various features to manage and monitor ActiveMQ.

ActiveMQ Admin Web Console
ActiveMQ Admin Web Console
Summary

In this article, we have explained how to install the latest version of Apache ActiveMQ on CentOS 8 and RHEL 8 Linux distribution. If you want to know more information especially about how to use Apache ActiveMQ, read the official ActiveMQ 5 documentation. Do not forget to send us your feedback via the comment form below.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

2 thoughts on “How to Install Apache ActiveMQ on CentOS/RHEL 8”

Leave a Reply to Chitusha Cancel reply

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.