How to Install Apache ActiveMQ on Ubuntu Server 22.04?

Sep 06, 2022 . Admin



Hi Guys,

This article will provide some of the most important example How to Install Apache ActiveMQ on Ubuntu Server 22.04?. I explained simply step by step ActiveMQ on Ubuntu 22.04 LTS. I would like to share with you Ways to Install ActiveMQ on Ubuntu 22.04 Example. you will learn Configure Apache ActiveMQ on Ubuntu 22.04 LTS. You just need to some step to done Steps to Install and Run Apache ActiveMQ on Ubuntu 22.04.

You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.

Follow the following steps to install apache activeMQ on linux ubuntu 22.04 system:

Step 1: Update System Dependencies

Step 2: Install JAVA

Step 3: Download Apache ActiveMQ

Step 4: Enable ActiveMQ Access

Step 5: Configuration File for ActiveMQ

Step 6: Reload the systemctl daemon

Step 7: Test the Installation of Apache ActiveMQ

Step 1: Update System Dependencies

First of all, update system dependencies by executing the following command on command line:

sudo apt update
Step 2: Install JAVA

The following command on command line to install java on linux ubuntu system:

sudo apt install default-jdk 

Then create a user on system by using the following command:

sudo adduser activemq
Step 3: Download Apache ActiveMQ

First, you will need to download the latest release from ActiveMQ’s official website.

wget https://dlcdn.apache.org//activemq/5.17.0/apache-activemq-5.17.0-bin.tar.gz
tar xzf apache-activemq-5.17.0-bin.zip -C /opt 

Second command will extract the file at /opt/apache-activemq-5.17.0 directory.

Step 4: Enable ActiveMQ Access

The default ActiveMQ allows on localhost only. To enable ActiveMQ access for a local or public network, edit conf/jetty.xml configuration file.

sudo nano /opt/apache-activemq-5.17.0/conf/jetty.xml

Search for the below configuration section.

<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
    <!-- the default port number for the web console -->
    <property name="host" value="localhost"/>
    <property name="port" value="8161"/>
</bean>
Step 5: Configuration File for ActiveMQ

The service startup easier, create a configuration file for ActiveMQ as below:

sudo nano /etc/systemd/system/activemq.service

Add the following content:

[Unit]
Description=Apache ActiveMQ Message Broker
After=network-online.target

[Service]
Type=forking

User=activemq
Group=activemq

WorkingDirectory=/opt/apache-activemq-5.17.0/bin
ExecStart=/opt/apache-activemq-5.17.0/bin/activemq start
ExecStop=/opt/apache-activemq-5.17.0/bin/activemq stop
Restart=on-abort

[Install]
WantedBy=multi-user.target
Step 6: Now reload the systemctl daemon to read the new configuration file.
sudo systemctl daemon-reload 

After that, enable the ActiveMQ systemd service to auto-start on system boot. Also, start the service.

sudo systemctl enable activemq.service 
sudo systemctl start activemq.service  

Once the service is started, make sure that ActiveMQ service is up and running:

sudo systemctl status activemq.service
Step 7: Test the Installation of Apache ActiveMQ

As the ActiveMQ installation is completed on the Ubuntu system. Let’s test if the installation is succeeded successfully.

If the UFQ firewall is active and you are accessing the Apache ActiveMQ from a remote host, make sure to open the 8161 port. You can open the UFW port with the following command.

sudo ufw allow 8161/tcp 

Now, open a browser and access

http://server-ip:8161/
#Ubuntu