On this article we will learn how to install Apache ActiveMQ version 5.16 on Linux CentOS 8 operating system.
Apache ActiveMQ is an open source message broker, multi-protocol, Java-based messaging server. It is written in Java together with a full Java Message Service (JMS) client and supports industry standard protocols so users get the benefits of client choices across a broad range of languages and platforms. Connectivity from C, C++, Python, .Net, and more is available. The last ActiveMQ stable version is 5.16 which was released on June 25, 2020.
The ActiveMQ project was originally created by its founders from LogicBlaze in 2004, as an open source message broker, hosted by CodeHaus. The code and ActiveMQ trademark were donated to the Apache Software Foundation in 2007, where the founders continued to develop the codebase with the extended Apache community.
Apache ActiveMQ Installation on CentOS 8
We will use, the latest stable ActiveMQ version for our tutorial test case. The installation steps will be consist of several steps, namely :
- Download and Extract Apache ActiveMQ Binary Distribution
- Create Apache ActiveMQ Systemd Unit
- Access Apache ActiveMQ Web console
Apache ActiveMQ requires Java
- 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. On our system it has been OpenJDK installed. For Java installation on CentOS tutorial can be found on How To Install Java (OpenJDK 11) On CentOS 8 article.
Download Apache ActiveMQ Binary Distribution
On this tutorial we will use the latest ActiveMQ binary distribution, ActiveMQ version 5.16. We will download by submitting command line :
ramans@otodiginet ~]$ wget https://www.apache.org/dist/activemq/5.16.0/apache-activemq-5.16.0-bin.tar.gz --2020-12-11 05:58:39-- https://www.apache.org/dist/activemq/5.16.0/apache-activemq-5.16.0-bin.tar.gz Resolving www.apache.org (www.apache.org)… 18.104.22.168, 22.214.171.124, 126.96.36.199, … Connecting to www.apache.org (www.apache.org)|188.8.131.52|:443… connected. HTTP request sent, awaiting response… 302 Found Location: https://downloads.apache.org/activemq/5.16.0/apache-activemq-5.16.0-bin.tar.gz [following] --2020-12-11 05:58:41-- https://downloads.apache.org/activemq/5.16.0/apache-activemq-5.16.0-bin.tar.gz Resolving downloads.apache.org (downloads.apache.org)… 184.108.40.206, 2a01:4f8:10a:201a::2 Connecting to downloads.apache.org (downloads.apache.org)|220.127.116.11|: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 binary distribution file (
apache-activemq-5.16.0-bin.tar.gz), will be located on user home directory, then we extract it to get the completed distribution file. We will extract the
tar.gz file by submitting command line :
tar xvf apache-activemq-5.16.0-bin.tar.gz. Then the files of extraction result will be moved to
[ramans@otodiginet ~]$ ls -ltr total 444548 -rw-rw-r--. 1 ramans ramans 62763232 Jul 2 20:44 apache-activemq-5.16.0-bin.tar.gz [ramans@otodiginet ~]$ tar xvf apache-activemq-5.16.0-bin.tar.gz [ramans@otodiginet ~]$ sudo mv apache-activemq-*/ /opt/apache-activemq
Now, the Apache ActiveMQ binary files has been exis on /opt/actviemq directory.
Create Apache ActiveMQ Systemd Unit on CentOS 8
When we intend to run ActiveMQ as a service, we need to create an ActiveMQ service unit file under the user called activemq. For this purpose we will start by creating the user and set the correct permissions on the ActiveMQ installation directory and all of its contents will be belong to the newly created user and group.
- Creat activemq user:
- Change ownership of ActiveMQ binary,
chown -R activemq:activemq /opt/apache-activemq/
- Add activemq.service file configuration:
- Reload the service:
[ramans@otodiginet ~]$ sudo useradd activemq [ramans@otodiginet ~]$ sudo su - Last login: Fri Dec 11 05:53:47 PST 2020 on pts/0 [root@otodiginet ~]# chown -R activemq:activemq /opt/apache-activemq/ [root@otodiginet ~]# vi /etc/systemd/system/apache-activemq.service [root@otodiginet ~]# systemctl daemon-reload
The /etc/systemd/system/apache-activemq.service file content :
Unit] Description=Apache ActiveMQ Messaging Server After=network.target [Service] Type=forking User=activemq Group=activemq ExecStart=/opt/apache-activemq/bin/activemq start ExecStop=/opt/apache-activemq/bin/activemq stop [Install] WantedBy=multi-user.target ~
After the ActiveMQ system file was created, then we will enable, start and query its status. For this purpose we will submit the command line :
systemctl enable | start | status apache-activemq.service
as shown below :
[root@otodiginet ~]# systemctl enable apache-activemq.service Created symlink /etc/systemd/system/multi-user.target.wants/apache-activemq.service → /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 -Djava.util.logging.config.file=logging.properties -Djava.security.auth.l> Dec 11 06:30:01 otodiginet systemd: Starting Apache ActiveMQ Messaging Server… Dec 11 06:30:01 otodiginet activemq: INFO: Loading '/opt/apache-activemq//bin/env' Dec 11 06:30:01 otodiginet activemq: INFO: Using java '/usr/bin/java' Dec 11 06:30:01 otodiginet activemq: INFO: Starting - inspect logfiles specified in logging.properties and log4j.p> Dec 11 06:30:01 otodiginet activemq: INFO: pidfile created : '/opt/apache-activemq//data/activemq.pid' (pid '5282') Dec 11 06:30:01 otodiginet systemd: Started Apache ActiveMQ Messaging Server.
Access ActiveMQ Web Console
To manage and monitori the ActiveMQ via web browser, it has been provided an ActiveMQ web console. If we want to access it, just open a web browser and point it to the following URL: http://localhost:8161 or http://ipserver:8161. Apache ActiveMQ using port on 8161, so if we had a firewall then we have to allow its port first.
Before using the ActiveMQ web console, we have to configure the user who could log in to the console. The configuration is located on
/opt/apache-activemq/conf/jetty-realm.properties file. The content of this file :
We have set user : admin and password : OtoAdm1n.
On this article we had installed the Apache ActiveMQ version 5.16.0 on Linux CentOS 8 operating system successfully. For more detail about Apache ActiveMQ can be follow the ActiveMQ guidance on https://activemq.apache.org.