How to Install Apache ActiveMQ on Ubuntu 22.04

Apache ActiveMQ is an open source message broker written in Java together with a full Java Message Service client. It provides “Enterprise Features” which in this case means fostering the communication from more than one client or server.

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.

In this tutorial, i am going to show you how to install apache activeMQ on linux ubuntu machine.

How to Install Apache ActiveMQ on Ubuntu 22.04

Use the below given steps to install apache activeMQ on linux ubuntu 22.04 machine:

  • 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

Start terminal and run the following command on terminal toupdate system dependencies:

sudo apt update 

Step 2 – Install JAVA

Run 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

Set the password to complete the user creation.

Step 3 – Download Apache ActiveMQ

Now, download apache ActiveMQ on linux ubuntu system by running the following command on 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

Run the following command on terminal 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 by running 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

Run 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 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/

Conclusion

In this tutorial, i have shown to you how to install, configure and use apache activeMQ on linux ubuntu system.

Be First to Comment

Leave a Reply

Your email address will not be published.