How to install ActiveMQ on RHEL 8

Apache ActiveMQ is a widely used messaging server written in Java. As messaging services commonly do, it creates a bridge between heterogeneous systems for reliable data exchange in the form of messages pushed into queues by producer clients, where they wait to be “read”, or consumed by consumer clients.

Naturally a system that is client to ActiveMQ can be both producer and consumer, and more than one systems can subscribe to a queue or topic, thus enabling flexible communication between these client systems. Many different platforms and protocols can be used to connect to ActiveMQ, increasing it’s usefulness even more.

In this tutorial we will install Apache ActiveMQ on Red Hat Enterprise Linux 8 from tarball, add the systemd unit files for ease of use, and access the admin page of our new service to create a queue.

In this tutorial you will learn:

  • How to install ActiveMQ from tarball
  • How to set up environment from the command line
  • How to add systemd unit files for ActiveMQ
  • How to access the admin page

Apache ActiveMQ Welcome page on RHEL 8

Apache ActiveMQ Welcome page on RHEL 8

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Red Hat Enterprise Linux 8
Software Apache ActiveMQ 5.15.8
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install activemq on Redhat 8 step by step instructions

Apache ActiveMQ requires a working Java 8 installation, and nothing more. We should keep in mind that messages will be held on disk, so appropriate space needed. In this tutorial we will not give real load to the server, the queue we create will not consume space, as it will be empty.

  1. To find the package we need, we can check out the home page of the release. We can find the URL there, which can be given to wget. We’ll install the application under the /opt directory, so we enter it:
    # cd /opt

    And download the package using the URL we aquired from the website:

    # wget "" -O apache-activemq-5.15.8-bin.tar.gz

    The site is clever enough to redirect us to the package on the closest mirror, but wget needs double quotes to handle the URL, and we can specify the name of the output file with -O, avoiding an URL as filename.

  2. We’ll extract the archive inplace:
    # tar -xvf apache-activemq-5.15.8-bin.tar.gz
  3. We add a symlink pointing to it that has a more user-friendly name:
    # ln -s /opt/apache-activemq-5.15.8 /opt/activemq
  4. For security’s sake, we do not run the service as root (nothing should run as root if does not need to). We create a user activemq, and the service will run in it’s name:
    # useradd activemq
  5. We set this new user as the owner of the contents of the extracted package, recursively:
    # chown -R activemq:activemq apache-activemq-5.15.8*
  6. We create a unit file, /etc/systemd/system/activemq.service, that will hold the definition of the service:
    Description=Apache ActiveMQ
    ExecStart=/opt/activemq/bin/activemq start
    ExecStop=/opt/activemq/bin/activemq stop
  7. We need to reload systemd in order to notice the new service:
    # systemctl daemon-reload
  8. And from now on, we can manage: start, stop, and get it’s status:
    # systemctl start|stop|status activemq
  9. If we plan to use this service on a regular basis, we can order systemd to start the service on every boot:
    # systemctl enable activemq

  10. To ensure all is working fine, after starting the service, we can check it’s logfile, which is /opt/activemq/data/activemq.log in our case. In this file, we can find an entry indicating that it is reachable with a browser:
    2019-01-15 15:59:14,359 | INFO  | ActiveMQ WebConsole available at | org.apache.activemq.web.WebConsoleStarter | main
  11. Port 8161 is the default port for ActiveMQ. If our machine is running a firewall, we need to open this port to access the WebConsole:
    # firewall-cmd --zone=public --add-port=8161/tcp --permanent
    # firewall-cmd --reload
  12. Now we can access our ActiveMQ WebConsole by pointing a browser to the machine’s hostname or IP address, port 8161, appending the URL with /admin, to see more than a welcome page and some links.
    Apache ActiveMQ Console page.

    Apache ActiveMQ Console page.

    This page will require authentication. As we did not change the default configuration, we can guess what the default username and password could be. Hint: let’s try admin/admin.

  13. Our ActiveMQ server is up and running, and we can manage it from the WebConsole. For example by clicking the “Queues” link, we can create a queue (empty on the below picture):
    ActiveMQ queues list with example queue.

    ActiveMQ queues list with example queue.

    We can start attaching clients to our ActiveMQ server, and provide it with messages to queue and forward to consumers when needed.