Skip to content

All topics  /  Linux

How to Install Apache ActiveMQ on Ubuntu?

Linux ·

For teams turning “How to Install Apache ActiveMQ on Ubuntu?” into a repeatable delivery task, the operational overview can document setup, troubleshooting and review time; managers should interpret those records alongside reliability and completed work, not as a stand-alone score.

Package and operating-system behaviour can change, so verify the commands and supported versions through Ubuntu before running them on a production host.

Hello Friends,

In this example, you will learn how to install Apache activemq on Ubuntu. I want to share with you the install Apache activemq on Ubuntu. This article goes into detail on activemq getting started with the Apache software foundation. you will learn Apache activemq installation on linux.

ActiveMQ is an open-source protocol developed by Apache, which functions as an implementation of message-oriented middleware (MOM). Its basic function is to send messages between different applications but includes additional features like STOMP, JMS, and OpenWire.

Step 1: Update System Dependencies


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

sudo apt update 

Step 2: Install JAVA

Then execute the following command on the command line to install Java on the linux ubuntu system:

sudo apt install default-jdk 

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

sudo adduser activemq

Set the password to complete the user creation.

Step 3: Download Apache ActiveMQ

Now, download Apache ActiveMQ on the linux ubuntu system by executing the following command on the command line:

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 

Once the download process has been done; Extract the file at /opt/apache-activemq-5.17.0 directory.

Step 4: Enable ActiveMQ Access

Use the following command 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

Then create a configuration file for ActiveMQ using the following command:

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

Then update the following content into it:

[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: Reload the systemctl daemon

Use the following command to 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 the ActiveMQ service is up and running:

sudo systemctl status activemq.service 

Step 7: Test the Installation of Apache ActiveMQ

ActiveMQ installation is finished on the linux Ubuntu 22.04 system. Let’s test if the installation is succeeded successfully.

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

sudo ufw allow 8161/tcp 

Finally, open a browser and hit the following URL into it:

http://server-ip:8161/