Apache ActiveMQ is a widely adopted, open-source platform used for messaging and integration in enterprise-level software solutions.
This guide will walk you through the process of setting up the binary distribution of Apache ActiveMQ on a CentOS 7 system.
Prerequisites
- A newly deployed CentOS 7 server, assigned the IP address
203.0.113.1. - A user account with
sudoprivileges. - Java version 7 or newer must be installed.
Matching infrastructure at centron
No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →
Step 1: System Update
Start by accessing your server via SSH using your sudo user credentials. Proceed to apply all available system updates through the EPEL YUM repository:
sudo yum install epel-release -y
sudo yum update -y
sudo shutdown -r nowOnce the system has rebooted, reconnect using the same sudo user account.
Step 2: Installing OpenJDK JRE 8
Apache ActiveMQ 5.x requires Java 7 or above. We'll install OpenJDK 8 JRE using the YUM package manager:
sudo yum install -y java-1.8.0-openjdkTo verify that Java has been installed correctly, run the following command:
java -versionYou should see output similar to the following:
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-b15)
OpenJDK 64-Bit Server VM (build 25.111-b15, mixed mode)Next, configure the JAVA_HOME environment variable by executing the following:
echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
source /etc/profileStep 3: Installing Apache ActiveMQ
You can download the most recent stable version of Apache ActiveMQ from its official releases page. As of the time this guide was written, version 5.14.3 was the latest available.
cd
wget https://archive.apache.org/dist/activemq/5.14.3/apache-activemq-5.14.3-bin.tar.gz
sudo tar -zxvf apache-activemq-5.14.3-bin.tar.gz -C /optTo make managing future upgrades easier, it's recommended to create a symbolic link that doesn't depend on the version number:
sudo ln -s /opt/apache-activemq-5.14.3 /opt/activemqStep 4: Create a Systemd Service for ActiveMQ
You can launch Apache ActiveMQ by executing its script directly:
cd /opt/activemq
sudo ./bin/activemq startAlternatively, for better control and integration with your system, you can configure it as a Systemd service. First, create the necessary service unit file:
sudo vi /usr/lib/systemd/system/activemq.serviceInsert the following content into the file:
[Unit]
Description=activemq message queue
After=network.target
[Service]
PIDFile=/opt/activemq/data/activemq.pid
ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop
User=root
Group=root
[Install]
WantedBy=multi-user.targetTo save and exit in vi, use:
:wq!Now you can start, stop, or enable ActiveMQ as a service using the following commands:
sudo systemctl enable activemq.service
sudo systemctl start activemq.service
sudo systemctl stop activemq.serviceStep 5: Using the Apache ActiveMQ Web Console
Once ActiveMQ is up and running, you can access its web interface.
Start the service:
sudo systemctl start activemq.serviceNext, allow access to port 8161 through the firewall:
sudo firewall-cmd --zone=public --permanent --add-port=8161/tcp
sudo firewall-cmd --reloadTo open the web console, launch a browser and go to:
http://203.0.113.1:8161/admin
The default login credentials are:
- Username:
admin - Password:
admin
These credentials can be changed by editing the following configuration file:
/opt/activemq/conf/jetty-realm.properties
Apache ActiveMQ is now successfully configured and operational. Thank you for following this tutorial.
Conclusion
By following this step-by-step guide, you have successfully installed and configured Apache ActiveMQ on a CentOS 7 server. You’ve prepared your environment with Java, downloaded and extracted the binary release, and set up ActiveMQ to run as a Systemd service. Additionally, you have enabled web console access, making it easier to monitor and manage your message queue server. This setup lays a solid foundation for building scalable, enterprise-grade messaging solutions using Apache ActiveMQ.
Testen Sie Ihr Setup auf ccloud³
Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.