How To

Run ActiveMQ on Rocky/Alma 8 (Step-by-Step)

Welcome to today’s guide on how to install Apache ActiveMQ on Rocky/AlmaLinux 8. Apache ActiveMQ is an open source and most popular multi-protocol messaging server written in Java. Apache ActiveMQ enables you to send messages from one application(sender) to another (receiver/consumer). This message broker has reasonable level of features, support for client libraries and a mature documentation that you can refer to.

Original content from computingforgeeks.com - post 48248

Key features of Apache ActiveMQ

Here is a summary for key Apache ActiveMQ.

Install Apache ActiveMQ on Rocky/Alma 8

This blog post has been written to walk you through the installation Apache ActiveMQ on Rocky/Alma 8 Linux distribution. The step are simple to follow along and doesn’t need good Linux background.

Step 1: Install Java

Start by installing Java on the system

sudo yum install vim java-17-openjdk java-17-openjdk-devel

Step 2: Download Apache ActiveMQ

Visit the Apache ActiveMQ downloads page to get the latest of Apache ActiveMQ.

wget https://dlcdn.apache.org//activemq/6.1.2/apache-activemq-6.1.2-bin.tar.gz

Extract the downloaded file.

tar xvf apache-activemq-6.1.2-bin.tar.gz

Move the directory created the /opt path.

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

This is a list of files in the directory.

$ ls -lh /opt/apache-activemq/
total 11M
-rwxr-xr-x 1 root root  11M Apr 11 17:35 activemq-all-6.1.2.jar
drwxr-xr-x 4 root root 4.0K Jul  9 22:14 bin
drwxr-xr-x 2 root root 4.0K Jul  9 22:14 conf
drwxr-xr-x 2 root root 4.0K Jul  9 22:14 data
drwxr-xr-x 2 root root 4.0K Jul  9 22:14 docs
drwxr-xr-x 7 root root 4.0K Apr 11 17:35 examples
drwxr-xr-x 6 root root 4.0K Jul  9 22:14 lib
-rw-r--r-- 1 root root  40K Apr 11 17:35 LICENSE
-rw-r--r-- 1 root root 3.3K Apr 11 17:35 NOTICE
-rw-r--r-- 1 root root 2.6K Apr 11 17:35 README.txt
drwxr-xr-x 6 root root 4.0K Jul  9 22:14 webapps
drwxr-xr-x 3 root root 4.0K Jul  9 22:14 webapps-demo

Step 3: Create Apache ActiveMQ Systemd Unit

Create activemq user for running the service.

sudo useradd activemq

Set directory permissions.

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

We’ll create a Systemd unit file for managing Apache ActiveMQ service.

sudo tee /etc/systemd/system/apache-activemq.service<<EOF

[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
EOF

Reload list of Systemd service unit files available.

sudo systemctl daemon-reload 

Put SELinux in permissive mode.

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

Now start and enable the service.

sudo systemctl enable apache-activemq.service
sudo systemctl start apache-activemq.service

Confirm service status:

$ systemctl status  apache-activemq.service 
● apache-activemq.service - Apache ActiveMQ Messaging Server
     Loaded: loaded (/etc/systemd/system/apache-activemq.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-07-09 22:17:05 UTC; 9s ago
    Process: 3207 ExecStart=/opt/apache-activemq/bin/activemq start (code=exited, status=0/SUCCESS)
   Main PID: 3261 (java)
      Tasks: 43 (limit: 2320)
     Memory: 171.4M (peak: 171.5M)
        CPU: 6.084s
     CGroup: /system.slice/apache-activemq.service
             └─3261 /usr/bin/java -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq//conf/login.config -Dcom.sun.management.jm>

Jul 09 22:17:05 well-com systemd[1]: Starting apache-activemq.service - Apache ActiveMQ Messaging Server...
Jul 09 22:17:05 well-com activemq[3207]: INFO: Loading '/opt/apache-activemq//bin/setenv'
Jul 09 22:17:05 well-com activemq[3207]: INFO: Using java '/usr/bin/java'
Jul 09 22:17:05 well-com activemq[3207]: INFO: Starting - inspect logfiles specified in logging.properties and log4j2.properties to get details
Jul 09 22:17:05 well-com activemq[3260]: INFO: pidfile created : '/opt/apache-activemq//data/activemq.pid' (pid '3261')
Jul 09 22:17:05 well-com systemd[1]: Started apache-activemq.service - Apache ActiveMQ Messaging Server.

Step 4: Change admin user password

Change the default admin user password to a unique one.

sudo vim /opt/apache-activemq/conf/credentials.properties
sudo vim /opt/apache-activemq/conf/credentials-enc.properties

Restart apache-activemq service after making the change.

sudo systemctl restart apache-activemq

Verify that authentication is working, replacing password with your password:

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

Output:

HTTP/1.1 200 OK
Date: Fri, 06 Mar 2020 19:41:51 GMT
X-FRAME-OPTIONS: SAMEORIGIN
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.22.v20191022)

A 200 OK message should be displayed. A 401 Unauthorized message means your user name or password is incorrect.

Step 5: Access Apache ActiveMQ Web console

The Web console will run on port 8161. Open your server IP address / hostname to access the ActiveMQ web console.

http://192.168.122.48:8161/admin/

Authenticate with username and password created.

install apache activemq centos linux

You should be presented with the ActiveMQ web interface which looks similar to below.

install apache activemq centos linux 02

Refer to Apache ActiveMQ documentation for more reading. Other related guides:

Related Articles

Monitoring Install LibreNMS on CentOS 7 with Let’s Encrypt and Nginx AlmaLinux Install Brave Browser on Rocky Linux 8 | AlmaLinux 8 | CentOS 8 CentOS Install Jellyfin Media Server on CentOS 8|Rocky Linux 8 Arch Linux i3 ssh configuration to unlock without passphrase

1 thought on “Run ActiveMQ on Rocky/Alma 8 (Step-by-Step)”

  1. It doesn’t work for me.

    Activemq systemd service runs fine as “Active” but:

    install]$ curl –head –user admin:smpc2020SMpc http://localhost:8161
    HTTP/1.1 302 Found
    Date: Fri, 19 Mar 2021 08:39:23 GMT
    X-FRAME-OPTIONS: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    Location: http://localhost:8161/index.html
    Content-Length: 0
    Server: Jetty(9.4.35.v20201120)

    Reply

Leave a Comment

Press ESC to close