Priya
- October 17, 2021
7 Steps to Install & Setup Apache ActiveMQ on Ubuntu 20.04 LTS
Apache ActiveMQ is a free & open source message broker tool,written in Java. It helps to send messages between different client applications, but includes additional features like STOMP, JMS, and OpenWire. It provides advanced features including message load-balancing and high-availability for data.
There are some steps to install & setup Apache ActiveMQ on ubuntu:
Step 1: Update the System.
apt-get update
Step 2: Install Java.
apt-get install default-jre
- Check the Java version.
java -version
- Here is the command output.
[email protected]:/home/ubuntu# java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
Step 3: Download the Apache ActiveMQ.
cd /tmp
wget http://archive.apache.org/dist/activemq/5.15.8/apache-activemq-5.15.8-bin.tar.gz
- Here is the command output.
[email protected]:/home/ubuntu# cd /tmp
[email protected]:/tmp# wget http://archive.apache.org/dist/activemq/5.15.8/apache-activemq-5.15.8-bin.tar.gz
--2021-10-17 07:15:18-- http://archive.apache.org/dist/activemq/5.15.8/apache-activemq-5.15.8-bin.tar.gz
Resolving archive.apache.org (archive.apache.org)... 138.201.131.134, 2a01:4f8:172:2ec5::2
Connecting to archive.apache.org (archive.apache.org)|138.201.131.134|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 58561031 (56M) [application/x-gzip]
Saving to: ‘apache-activemq-5.15.8-bin.tar.gz’
apache-activemq-5.15.8-bin.tar.gz 100%[===========================================================================================>] 55.85M 7.58MB/s in 8.9s
2021-10-17 07:15:27 (6.30 MB/s) - ‘apache-activemq-5.15.8-bin.tar.gz’ saved [58561031/58561031]
- Extract the Downloaded folder.
tar -xvzf apache-activemq-5.15.8-bin.tar.gz
- Move the extracted folder to /opt.
mv apache-activemq-5.15.8 /opt/activemq
Step 4: Create a user & group.
addgroup --quiet --system activemq
adduser --quiet --system --ingroup activemq --no-create-home --disabled-password activemq
- Provide the following permission to /opt/activemq folder.
chown -R activemq:activemq /opt/activemq
- Here is the command output.
[email protected]:/tmp# mv apache-activemq-5.15.8 /opt/activemq
[email protected]:/tmp# addgroup --quiet --system activemq
[email protected]:/tmp# adduser --quiet --system --ingroup activemq --no-create-home --disabled-password activemq
[email protected]:/tmp# chown -R activemq:activemq /opt/activemq
Step 5: Create a ActiveMQ systemd service file.
vim /etc/systemd/system/activemq.service
- Add the following lines:
[Unit]
Description=Apache ActiveMQ
After=network.target
[Service]
Type=forking
User=activemq
Group=activemq
ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop
[Install]
WantedBy=multi-user.target
Step 6: Start & Enable the ActiveMQ service.
systemctl daemon-reload
systemctl start activemq
systemctl enable activemq
- Check the ActiveMQ status.
/opt/activemq/bin/activemq status
- Here is the command output.
[email protected]:/tmp# systemctl daemon-reload
[email protected]:/tmp# systemctl start activemq
[email protected]:/tmp# systemctl enable activemq
Created symlink /etc/systemd/system/multi-user.target.wants/activemq.service → /etc/systemd/system/activemq.service.
[email protected]:/tmp# /opt/activemq/bin/activemq status
INFO: Loading '/opt/activemq//bin/env'
INFO: Using java '/usr/bin/java'
ActiveMQ is running (pid '4401')
- Restart the Apache ActiveMQ service.
systemctl restart activemq
Step 7: Open Apache ActiveMQ web interface.
http://server-ip:8161/admin
- Here is the output.
- By default,username: admin & Password: admin.
- Click on Sign in.
- Now,Apache ActiveMQ is Ready.