In this tutorial, we will show you how to install Apache ActiveMQ on CentOS 8. For those of you who didn’t know, Apache ActiveMQ is a free, multi-protocol, Java-based message broker software written in Java. It supports industry-standard protocols that allow communication between separate applications.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Apache ActiveMQ on the CentOS 8 system.
Prerequisites
- A server running one of the following operating systems: CentOS 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Apache ActiveMQ on CentOS 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf clean all sudo dnf update
Step 2. Installing Java.
Apache ActiveMQ is a Java-based application so Java must be installed in your system:
sudo dnf install java-11-openjdk-devel
Step 3. Download Apache ActiveMQ on CentOS 8.
Download the latest version of ActiveMQ from their official website. You can download it using the following command:
wget https://www.apache.org/dist/activemq/5.15.12/apache-activemq-5.15.12-bin.tar.gz
Once downloaded, extract the downloaded file:
tar -xvzf apache-activemq-5.15.12-bin.tar.gz mv apache-activemq-5.15.12 apache-activemq
Next, create an ActiveMQ user for running the service:
useradd activemq chown -R activemq:activemq /opt/apache-activemq/
Step 4. Create Apache ActiveMQ Systemd.
We’ll create a Systemd unit file for managing the Apache ActiveMQ service:
nano /etc/systemd/system/apache-activemq.service
Add the following lines:
[Unit] Description=Apache ActiveMQ Messaging Server After=network.target [Service] Type=forking User=activemq Group=activemq ExecStart=/opt/apache-activemq/bin/activemq start ExecStop=/opt/apache-activemq/bin/activemq stop [Install] WantedBy=multi-user.target
Save the file. Then reload the systemd
manager configuration to read the newly created service, using the following command:
sudo systemctl daemon-reload systemctl start apache-activemq systemctl enable apache-activemq
Step 5. Configure Firewall.
You will need to allow ports 80 and 8161 through firewalld. You can allow them with the following command:
firewall-cmd --zone=public --permanent --add-port=8161/tcp firewall-cmd --zone=public --permanent --add-port=80/tcp firewall-cmd --reload
Step 6. Accessing Apache ActiveMQ.
ActiveMQ will be available on HTTP port 8161 by default. Open your favorite browser and navigate to http://your-domain.com/8161/admin/
or http://your-server-ip/8161/admin/
and you should be prompted for a username and password. The default is admin/admin
Congratulations! You have successfully installed Apache ActiveMQ on CentOS 8. Thanks for using this tutorial for installing Apache ActiveMQ on CentOS 8 systems. For additional help or useful information, we recommend you to check the official Apache ActiveMQ website.