Introduction
A message broker enables applications to communicate with each other to share information. Apache ActiveMQ is a popular open-source, multi-protocol, Java message broker. It supports industry-standard protocols such as AMQP (Advanced Message Queuing Protocol) to integrate multi-platform applications, STOMP (Simple Text Orientated Messaging Protocol) for exchanging messages between web applications over websockets, and MQTT (Message Queuing Telemetry Transport) to manage IoT devices. In this article, you will learn how to install Apache ActiveMQ on Ubuntu 20.04 server.
Prerequisites
- Deploy a fully updated Rcs Ubuntu 20.04 Server.
- Create a non-root user with sudo access.
1. Install Java
Update the system.
$ sudo apt updateApache ActiveMQ requires Java to run. Install Java.
$ sudo apt install openjdk-11-jre -yVerify the Java installation.
$ java -version
2. Install and Configure Apache ActiveMQ
Download ActiveMQ from the Apache. To find the latest version of this software, you can visit the download page.
$ wget http://archive.apache.org/dist/activemq/5.16.3/apache-activemq-5.16.3-bin.tar.gzExtract the downloaded file.
$ sudo tar -xvzf apache-activemq-5.16.3-bin.tar.gzCreate a directory named
/opt/activemq.$ sudo mkdir /opt/activemqMove the extracted files to the
/opt/activemqdirectory.$ sudo mv apache-activemq-5.16.3/* /opt/activemqCreate a group account
activemqto run Apache ActiveMQ.$ sudo addgroup --quiet --system activemqCreate a user for the group.
$ sudo adduser --quiet --system --ingroup activemq --no-create-home --disabled-password activemqChange the permissions of the
/opt/activemqdirectory.$ sudo chown -R activemq:activemq /opt/activemqCreate an ActiveMQ systemd service file to control the Apache ActiveMQ service.
$ sudo nano /etc/systemd/system/activemq.serviceAdd the below code into the file. Save and close the file.
[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.targetEdit the
jetty.xmlconfiguration file to change the host.$ sudo nano /opt/activemq/conf/jetty.xmlFind the line below:
<property name="host" value="127.0.0.1"/>Change it to:
<property name="host" value="0.0.0.0"/>Save and close the file.
Reload the system daemon.
$ sudo systemctl daemon-reloadStart the Apache ActiveMQ service.
$ sudo systemctl start activemqEnable the Apache ActiveMQ service to run at system startup.
$ sudo systemctl enable activemqVerify the status of the service.
$ sudo systemctl status activemqRestart ActiveMQ service.
$ sudo systemctl restart activemq
3. Access Apache ActiveMQ Web Interface
Open your web browser and access the Apache ActiveMQ web UI using the URL http://YourServerIP:8161/admin/. For example:
http://192.0.2.10:8161/admin/Conclusion
You have successfully installed Apache ActiveMQ on your Ubuntu server. Use the default credentials admin as your username and admin as your password to log in. You can now configure Apache ActiveMQ via the dashboard.
More Information
For more information on Apache ActiveMQ, please visit the official documentation.