We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install Apache ActiveMQ on CentOS 8

Learn how to – How To Install Apache ActiveMQ on CentOS 8.

Welcome to today’s guide on how to install Apache ActiveMQ on CentOS 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.

Key features of Apache ActiveMQ

Here is a summary for key Apache ActiveMQ.

Install Apache ActiveMQ on CentOS 8

This blog post has been written to walk you through the installation Apache ActiveMQ on CentOS 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 CentOS 8:

Install Java 11 on CentOS 8

Install Java 8 on CentOS 8

Step 2: Download Apache ActiveMQ on CentOS 8

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

wget https://www.apache.org/dist/activemq/5.15.11/apache-activemq-5.15.11-bin.tar.gz

Extract the downloaded file.

tar xvf apache-activemq-5.15.11-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 18M
-rwxr-xr-x. 1 cloud-user cloud-user  18M Nov 20 19:59 activemq-all-5.15.11.jar
drwxrwxr-x. 5 cloud-user cloud-user  147 Mar  6 21:14 bin
drwxr-xr-x. 2 cloud-user cloud-user 4.0K Mar  6 21:14 conf
drwxr-xr-x. 2 cloud-user cloud-user   26 Mar  6 21:14 data
drwxr-xr-x. 2 cloud-user cloud-user   76 Mar  6 21:14 docs
drwxr-xr-x. 7 cloud-user cloud-user   71 Nov 20 20:25 examples
drwxr-xr-x. 6 cloud-user cloud-user 4.0K Mar  6 21:14 lib
-rw-r--r--. 1 cloud-user cloud-user  40K Nov 20 20:25 LICENSE
-rw-r--r--. 1 cloud-user cloud-user 3.3K Nov 20 20:25 NOTICE
-rw-r--r--. 1 cloud-user cloud-user 2.6K Nov 20 20:25 README.txt
drwxr-xr-x. 6 cloud-user cloud-user   95 Mar  6 21:14 webapps
drwxrwxr-x. 3 cloud-user cloud-user   18 Mar  6 21:14 webapps-demo

Step 3: Create Apache ActiveMQ Systemd Unit on CentOS 8

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 vim /etc/systemd/system/apache-activemq.service

[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

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; vendor preset: disabled)
   Active: active (running) since Fri 2020-03-06 22:06:09 EAT; 5s ago
  Process: 4306 ExecStop=/opt/apache-activemq/bin/activemq stop (code=exited, status=1/FAILURE)
  Process: 4680 ExecStart=/opt/apache-activemq/bin/activemq start (code=exited, status=0/SUCCESS)
 Main PID: 4732 (java)
    Tasks: 14 (limit: 11512)
   Memory: 91.9M
   CGroup: /system.slice/apache-activemq.service
           └─4732 /usr/bin/java -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activem>

Mar 06 22:06:09 cent8.novalocal systemd[1]: Starting Apache ActiveMQ Messaging Server...
Mar 06 22:06:09 cent8.novalocal activemq[4680]: INFO: Loading '/opt/apache-activemq//bin/env'
Mar 06 22:06:09 cent8.novalocal activemq[4680]: INFO: Using java '/usr/bin/java'
Mar 06 22:06:09 cent8.novalocal activemq[4680]: INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
Mar 06 22:06:09 cent8.novalocal activemq[4680]: INFO: pidfile created : '/opt/apache-activemq//data/activemq.pid' (pid '4732')
Mar 06 22:06:09 cent8.novalocal systemd[1]: Started Apache ActiveMQ Messaging Server.

Step 4: Change admin user password

Change the default admin user password to a unique one.

$ sudo vi /opt/apache-activemq/conf/jetty-realm.properties

User definitions in this file take the following form:

username: password [,rolename ...]

I’ve updated mine like below.

admin: MyAdminPassw0rd, admin
user: MyUserPassw0rd, user

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.

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

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

How To Install RabbitMQ on RHEL 8 / CentOS 8

How to Setup RabbitMQ Cluster on Ubuntu 18.04 LTS

How To Backup and Restore RabbitMQ Data & Configurations

Cart

Your Cart is Empty

Back To Shop