Apache ActiveMQ on Ubuntu 24.04 on Azure User Guide
Overview
Apache ActiveMQ Classic is the open-source, multi-protocol Java message broker that implements the JMS API and speaks OpenWire, AMQP, STOMP and MQTT. It moves messages between distributed applications reliably, with durable queues and topics backed by a persistent store. The cloudimg image installs ActiveMQ 6.2.6 on OpenJDK 17 at /opt/activemq, runs it as a dedicated activemq system user, fronts the Jetty web console with an nginx reverse proxy on TCP 80, persists the KahaDB message store on a dedicated Azure data disk, and generates a unique web-console password on the first boot of every VM. Backed by 24/7 cloudimg support.
What is included:
- Apache ActiveMQ Classic 6.2.6 broker on OpenJDK 17 at
/opt/activemq - nginx reverse proxy on
:80in front of the Jetty web console (bound to loopback:8161) - OpenWire
61616, AMQP5672, STOMP61613and MQTT1883transport connectors - A dedicated Azure data disk at
/var/lib/activemqholding the KahaDB persistence store — separate from the OS disk and re-provisioned with every VM - Per-VM web console password (
ACTIVEMQ_ADMIN_PASSWORD) generated at first boot, in a root-only file activemq.service+nginx.serviceas systemd units, enabled and active- 24/7 cloudimg support
Prerequisites
An active Azure subscription, an SSH key pair, and a VNet + subnet in the target region. Standard_B2ms (2 vCPU / 8 GiB RAM) is a good starting point for the JVM broker; scale up for higher message throughput. NSG inbound: allow 22/tcp from your management network, 80/tcp for the web console (front with TLS for public exposure — see Enabling HTTPS), and the transport ports your clients use (61616 OpenWire, 5672 AMQP, 61613 STOMP, 1883 MQTT) from your application networks.
Step 1 — Deploy from the Azure Marketplace
Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Apache ActiveMQ by cloudimg, and select Create. On Basics pick your subscription, resource group, region and size; under Administrator account choose SSH public key and paste your key; under Inbound port rules allow SSH (22) and HTTP (80). Review the dedicated data disk on the Disks tab, then Review + create → Create.
Step 2 — Deploy from the Azure CLI
az vm create \
--resource-group <your-rg> \
--name activemq \
--image <marketplace-image-urn> \
--size Standard_B2ms \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_ed25519.pub \
--vnet-name <your-vnet> --subnet <your-subnet> \
--public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name activemq --port 80 --priority 1010
Step 3 — Connect to your VM
ssh azureuser@<vm-public-ip>
Step 4 — Confirm the services are running
systemctl is-active activemq.service nginx.service
Both services report active. The broker can take a minute or two to fully start on first boot while the JVM warms up.

Step 5 — Retrieve your web console password
The web console password is generated uniquely on the first boot of your VM and written to a root-only file:
sudo cat /root/activemq-credentials.txt
The ACTIVEMQ_ADMIN_PASSWORD value is the password; sign in to the web console as admin with it.

Step 6 — Open the web console
Browse to http://<vm-public-ip>/ and sign in as admin with the password from Step 5. The ActiveMQ web console lets you browse queues and topics, inspect message counts, send and purge messages, and view broker and connection details.



Step 7 — Verify the broker health
The broker exposes a Jolokia REST endpoint behind the console. Read the broker version to confirm it is healthy (replace <password>):
PW=<password>
curl -s -u admin:$PW -H 'Origin: http://<vm-public-ip>' -H 'Content-Type: application/json' \
-X POST -d '{"type":"read","mbean":"org.apache.activemq:type=Broker,brokerName=localhost","attribute":"BrokerVersion"}' \
'http://<vm-public-ip>/api/jolokia/'
The response is JSON with "status":200 and the broker version in value. The Jolokia
endpoint only accepts POST and requires a same-origin request, so the Origin header must
match the host you are calling.

Step 8 — Send and receive a test message
ActiveMQ ships a producer/consumer CLI. Send five messages to a queue, then drain them (run on the VM):
DIR=$(ls -d /opt/activemq/apache-activemq-*/); sudo -u activemq "$DIR/bin/activemq" producer --destination queue://demo.queue --messageCount 5 --brokerUrl tcp://127.0.0.1:61616
DIR=$(ls -d /opt/activemq/apache-activemq-*/); sudo -u activemq "$DIR/bin/activemq" consumer --destination queue://demo.queue --messageCount 5 --brokerUrl tcp://127.0.0.1:61616
The producer reports Produced: 5 messages and the consumer reports Received: 5. The queue and its messages persist in the KahaDB store on the dedicated data disk.
Step 9 — Connect from your applications
Point JMS / OpenWire clients at tcp://<vm-public-ip>:61616, AMQP 1.0 clients at amqp://<vm-public-ip>:5672, STOMP clients at <vm-public-ip>:61613, and MQTT clients at <vm-public-ip>:1883. Open the matching NSG ports from your application networks only.
Enabling HTTPS
For production, terminate TLS at nginx with a real domain pointed at the VM's public IP. Install certbot and request a certificate (replace the domain):
sudo apt-get update && sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.example.com
Backup and maintenance
The KahaDB persistence store and broker data live on the dedicated data disk at /var/lib/activemq. Snapshot that disk in Azure to back up your durable queues and topics, and keep the OS patched with sudo apt update && sudo apt upgrade. The broker restarts cleanly with sudo systemctl restart activemq.
Support
This image is backed by 24/7 cloudimg support. Contact us by email and chat for help with broker configuration, protocol connectors, clustering, persistence, TLS and backups.
All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.