Guide to install Apache ActiveMQ on Ubuntu 20.04
Apache ActiveMQ is a free, open-source, Java-based message broker software from the Apache Foundation. It is used to send messages between different applications and also offers additional features such as STOMP, JMS, and OpenWire. It supports industry-standard protocols that enable communication between different applications.
Apache ActiveMQ is the best choice for you if you are looking for a powerful message broker for your applications.
In this tutorial, we will show you how to install Apache ActiveMQ on Ubuntu 20.0
Requirements
A server was running Ubuntu 20.04.
The server is configured with a root password.
Install Java
Apache ActiveMQ is a Java-based application, so Java must be installed on your server. If it’s not installed, you can install it with the following command:
apt-get install openjdk-11-jdk openjdk-11-jre -y
After installation, you can check the Java version with the following command:
java version
You should get the following output:
OpenJDK version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)
Install Apache ActiveMQ
At the time of writing this tutorial, the latest version of ActiveMQ is 5.16.0. You can download them with the following command:
wget
Once the download is complete, unzip the downloaded file with the following command:
tar -xvzf apache-activemq-5.16.0-bin.tar.gz
Next, move the unzipped directory to the /opt directory with the following command:
mv apache-activemq-5.16.0 /opt/activemq
Next you need to create a new user and group to run Apache ActiveMQ. You can create them with the following command:
addgroup --quiet --system activemq
adduser --quiet --system --ingroup activemq --no-create-home --disabled-password activemq
Next, change the ownership of the /opt/activemq directory to activemq as shown below:
chown -R activemq:activemq /opt/activemq
When you’re done with that, you can move on to the next step.
Create a systemd service file for ActiveMQ
Next you need to create a systemd service file to manage the ActiveMQ service. You can create them with the following command:
nano /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
Save and close the file when finished. Then you reload the systemd daemon with the following command:
systemctl daemon-reload
Next, start the ActiveMQ service and enable it to start on system reboot with the following command:
systemctl start activemq
systemctl enable activemq
Now you can check the ActiveMQ service status with the following command:
systemctl status activemq
You should get the following output:
? activemq.service - Apache ActiveMQ
Loaded: loaded (/etc/systemd/system/activemq.service; disabled; vendor preset: enabled)
Active: active (running) since Sat 2020-08-01 11:43:25 UTC; 22s ago
Process: 31092 ExecStart=/opt/activemq/bin/activemq start (code=exited, status=0/SUCCESS)
Main PID: 31165 (java)
Tasks: 49 (limit: 2353)
Memory: 190.5M
CGroup: /system.slice/activemq.service
??31165 /usr/bin/java -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/ac>
Aug 01 11:43:25 ubuntu2004 systemd[1]: Starting Apache ActiveMQ...
Aug 01 11:43:25 ubuntu2004 activemq[31092]: INFO: Loading '/opt/activemq//bin/env'
Aug 01 11:43:25 ubuntu2004 activemq[31092]: INFO: Using java '/usr/bin/java'
Aug 01 11:43:25 ubuntu2004 activemq[31092]: INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get deta>
Aug 01 11:43:25 ubuntu2004 activemq[31164]: INFO: pidfile created : '/opt/activemq//data/activemq.pid' (pid '31165')
Aug 01 11:43:25 ubuntu2004 systemd[1]: Started Apache ActiveMQ.
lines 1-16/16 (END)
At this point, ActiveMQ is running and listening on port 8161.
Access to the Apache ActiveMQ web interface
By default, Apache ActiveMQ is configured to access from localhost. So you have to configure it for access from external hosts. You can configure this by editing the /opt/activemq/conf/jetty.xml file:
nano /opt/activemq/conf/jetty.xml
Find the following line:
<property name="host" value="127.0.0.1"/>
Replace them with the following line:
<property name="host" value="your-server-ip"/>
Save and close the file and restart the Apache ActiveMQ service to apply the changes:
systemctl restart activemq
Now open your web browser and call Apache ActiveMQ via the URL http://your-server-ip:8161:/ admin . You will be asked for a username and password (see below):

Enter the default username and password admin/admin and click on the “ Login ” button . You should see the Apache ActiveMQ Dashboard on the following screen:
Conclusion
Congratulation! You have successfully installed Apache ActiveMQ on Ubuntu 20.04. Now you can start developing your first ActiveMQ messaging application.
Latest News in Gaming: ‘Diablo Immortal’ ranks 9th in Google sales