Prerequisites
Before beginning the installation, ensure you have the following:
- A Vultr Ubuntu 20.04 server: Deploy a fresh instance from the Vultr control panel.
- Non-root user with sudo privileges: For security purposes, it's recommended to perform administrative tasks using a non-root user with sudo access.
Step 1: Install Java
Apache ActiveMQ requires Java to operate. To install OpenJDK 11:
Update the system package index:
sudo apt update
Install OpenJDK 11:
sudo apt install openjdk-11-jre -y
Verify the Java installation:
java -version
Ensure that the output displays the correct version of Java.
Step 2: Install and Configure Apache ActiveMQ
Download the latest version of Apache ActiveMQ:
wget
Extract the downloaded tarball:
sudo tar -xvzf apache-activemq-5.16.3-bin.tar.gz
Create a directory for ActiveMQ:
sudo mkdir /opt/activemq
Move the extracted files to the new directory:
sudo mv apache-activemq-5.16.3/* /opt/activemq
Create a system group and user for ActiveMQ:
sudo addgroup --quiet --system activemq
sudo adduser --quiet --system --ingroup activemq --no-create-home --disabled-password activemq
Change ownership of the ActiveMQ directory:
sudo chown -R activemq:activemq /opt/activemq
Create a systemd service file for ActiveMQ:
sudo nano /etc/systemd/system/activemq.service
Add the following content:
[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.
Reload systemd to apply the new service file:
sudo systemctl daemon-reload
Start the ActiveMQ service:
sudo systemctl start activemq
Enable ActiveMQ to start on boot:
sudo systemctl enable activemq
Check the status of the ActiveMQ service:
sudo systemctl status activemq
- Ensure that the service is active and running.
Step 3: Access the ActiveMQ Web Interface
By default, ActiveMQ's web interface listens only on localhost. To allow remote access:
Edit the Jetty configuration:
sudo nano /opt/activemq/conf/jetty.xml
Locate the following line:
<property name="host" value="127.0.0.1"/>
Change it to:
<property name="host" value="0.0.0.0"/>
- Save and close the file.
Restart the ActiveMQ service:
sudo systemctl restart activemq
Now, you can access the ActiveMQ web interface by navigating to:http://<YourServerIP>:8161/admin/
Log in using the default credentials:
- Username: admin
- Password: admin
Conclusion
By following these steps, you have successfully installed and configured Apache ActiveMQ on your Ubuntu 20.04 server. This setup enables you to leverage ActiveMQ's messaging capabilities for your applications. For more detailed information and advanced configurations, refer to the official Vultr Docs.