Linux

How to Install Apache ActiveMQ on Debian 10

How to Install Apache ActiveMQ on Debian 10

Apache ActiveMQ is an open source message broker written in Java developed by Apache. This is one of the most popular message brokers. It offers strength and flexibility, supports multi-protocol and java-based message servers. Connectivity from major programming languages ​​such as C, C ++, Python, .Net, etc.

Apache ActiveMQ allows you to integrate multi-platform applications using the ubiquitous AMPQ protocol. Exchange between web applications using STOMP through websocket, managing IoT devices using MQTT, and supporting JMS infrastructure and so on.

In this tutorial, we will show you how to install Apache ActiveMQ on the latest Debian Buster 10. We will install ActiveMQ using official binary files, set ActiveMQ as a systemd service, and enable password authentication.

Precondition

For this guide, we will use the latest Debian Buster 10 with 2GB of RAM, 50GB of free disk space, and 2 CPUs.

What we will do?

  • Install Java on Debian 10
  • Download and install Apache ActiveMQ
  • Set Apache ActiveMQ as Systemd Service
  • Encrypted Password Setup for the Web Console
  • Testing

Step 1 – Install Java on Debian 10

First, we will install Java OpenJDK and JRE into Debian Buster 10. Both packages are available by default in the Debian repository.

Update all available repositories on the Debian system and install the Java OpenJDK and JRE using the apt command below.

sudo apt update
sudo apt install default-jdk default-jre

After all installation is complete, check the Java version using the following command.

java -version

Below is the response you will get.

openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Debian-3deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Debian-3deb10u1, mixed mode, sharing)

As a result, Java OpenJDK and JRE ’11’ have been installed on the Debian Server.

Step 2 – Download and install Apache ActiveMQ

In this step, we will download and install Apache ActiveMQ to our Debian system.

Before proceeding further, let’s create a new ‘activemq’ user system using the following command.

adduser --system --no-create-home --disabled-login --group activemq

Now download the Apache ActiveMQ Binary file and extract the file using the following command.

wget --quiet http://www-us.apache.org/dist/activemq/5.15.12/apache-activemq-5.15.12-bin.tar.gz
tar -xf apache-activemq-5.15.12-bin.tar.gz

After that, move the Apache ActiveMQ directory to ‘/ opt / activemq’ and change the ownership of the ActiveMQ directory to the ‘activemq’ user.

mv apache-activemq-*/ /opt/activemq
sudo chown -R activemq:activemq /opt/activemq

As a result, Apache ActiveMQ is installed on the Debian System.

1

Step 3 – Set Apache ActiveMQ as Systemd Service

After downloading and installing Apache ActiveMQ, we will set ActiveMQ as a systemd service.

Now go to the ‘/ etc / systemd / system’ directory and create a new service file ‘activemq.service’ using vim editor.

cd /etc/systemd/system/
vim activemq.service

Paste the following configuration into it.

[Unit]
Description=Apache ActiveMQ
After=network.target

[Service]
Type=forking
WorkingDirectory=/opt/activemq/bin
ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop
Restart=on-abort
User=activemq
Group=activemq

[Install]
WantedBy=multi-user.target

Save and close.

Next, reload the systemd manager to apply the new systemd service configuration.

systemctl daemon-reload

Now start the ActiveMQ server and add it to the system boot.

systemctl start activemq
systemctl enable activemq

2

As a result, Apache ActiveMQ is up and running, check using the following command.

systemctl status activemq

Below are the results that you will get.

3

Step 4 – Setup Encrypted Passwords for the Web Console

By default, ActiveMQ Web Console authentication is enabled, all users and passwords for ActiveMQ are stored in ‘jetty-realm.properties’ as plain text. For this step, we will change the plain text password with an encrypted password.

First, download the jetty distribution and extract.

wget --quiet https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.28.v20200408/jetty-distribution-9.4.28.v20200408.tar.gz
tar -xf jetty-distribution-*.tar.gz

Now go to the ‘jetty-distribution- *’ directory.

cd jetty-distribution-*/

Run the following command to generate your password, and be sure to change the ‘salt’ and password with your own password.

java -cp lib/jetty-util-9*.jar org.eclipse.jetty.util.security.Password salt password

Now you will get the following response.

2020-04-29 07:15:22.367:INFO::main: Logging initialized @194ms to org.eclipse.jetty.util.log.StdErrLog
mypassword
OBF:1uh41zly1x8g1vu11ym71ym71vv91x8e1zlk1ugm
MD5:34819d7beeabb9260a5c854bc85b3e44
CRYPT:myylAylKPNtmw

Copy the encrypted password ‘CRYPT: myy …’ to your notes, because that password will be used for ActiveMQ.

Now go to the ActiveMQ configuration directory ‘/ opt / activemq / conf’ and edit the ‘jetty-realm.properties’ configuration using vim editor.

cd /opt/activemq/conf/
vim jetty-realm.properties

Change the default admin password with the encrypted password generated ‘CRYPT: myy …’ as below.

admin: CRYPT:myylAylKPNtmw, admin
user: user, user

Save and close.

Next, restart the Apache ActiveMQ service to apply the new configuration.

systemctl restart activemq

4

As a result, the configuration of the ActiveMQ Web Console with an encrypted password has been completed.

Step 5 – Testing

Now open your web browser and type the server’s IP address with port ‘8161’.

http: // serverip: 8161 /

And you will get the default index.html page from ActiveMQ Web Console.

5

Next, add the ‘/ admin’ path to the URL as below.

http: // serverip: 8161 / admin

And you will be asked to ActiveMQ authentication.

6

Type ‘admin’ the default user with your password as generated above, then click ‘OK’ to enter.

After your password is correct, you will get an ActiveMQ Dashboard as below.

7

As a result, the installation and configuration of Apache ActiveMQ on Debian Buster 10 has been completed successfully.

Related posts

How to Install Gitea on CentOS 8

Linux

How to install CMake on Ubuntu

Linux

How to install Logstash Logfile Analytics Software on Ubuntu 20.04

Linux

How to Install a Plex Media Server on Ubuntu 20.04 / Linux Mint 20

Linux

How to Install the NoSQL Apache CouchDB Database on CentOS 8

Linux

How to Check Memory Usage on Linux

Linux

How to Install an Ubuntu 20.04 LTS (Focal Fossa) Server

Howto

How Linux makes data recovery easy

Linux

How to Install GCC (build-essential) on Ubuntu 20.04

Linux