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. It is one of the most popular message agents. It has powerful functions and flexibility, supports multi-protocol and Java-based messaging server. Connections from major programming languages (eg C, C ++, Python, .Net, etc.).
Apache ActiveMQ allows you to integrate multi-platform applications using the ubiquitous AMPQ protocol. Use STOMP on WebSocket to exchange between web applications, use MQTT to manage IoT devices, and support JMS infrastructure and others.
In this tutorial, we will show you how to install Apache ActiveMQ on the latest Debian Buster 10. We will install ActiveMQ using official binaries, set ActiveMQ as the systemd service, and enable password verification.
prerequisites
For this guide, we will use the latest Debian Buster 10 with 2GB RAM, 50GB free disk space and 2 CPUs.
What are we going to do?
- Install Java on Debian 10
- Download and install Apache ActiveMQ
- Set Apache ActiveMQ as a system service
- Set the encrypted password of the web console
- testing
Step 1-Install Java on Debian 10
First, we install Java OpenJDK and JRE to Debian Buster10. By default, both packages are available in the Debian repository.
Update all available repositories on Debian systems and install Java OpenJDK and JRE using the apt command below.
sudo apt updatesudo apt install default-jdk default-jre
Once all installations are complete, use the following command to check the Java version.
java -version
Here are the answers you will get.
openjdk version "11.0.7" 2020-04-14OpenJDK 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 Apache ActiveMQ and install it on our Debian system.
Before proceeding, let us create a new system user ‘activemq’ using the following command.
adduser --system --no-create-home --disabled-login --group activemq
Now download the Apache ActiveMQ Binary file and unzip 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.gztar -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 user “activemq”.
mv apache-activemq-*/ /opt/activemqsudo chown -R activemq:activemq /opt/activemq
As a result, Apache ActiveMQ was installed on the Debian system.
Step 3-Set up Apache ActiveMQ as a system service
After downloading and installing Apache ActiveMQ, we will set ActiveMQ as a system service.
Now go to the “/ etc / systemd / system” directory and use the vim editor to create a new service file “activemq.service”.
cd /etc/systemd/system/vim activemq.service
Paste the following configuration into it.
[Unit]Description=Apache ActiveMQAfter=network.target[Service]Type=forkingWorkingDirectory=/opt/activemq/binExecStart=/opt/activemq/bin/activemq startExecStop=/opt/activemq/bin/activemq stopRestart=on-abortUser=activemqGroup=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 activemqsystemctl enable activemq
Therefore, Apache ActiveMQ is up and running, please check it with the following command.
systemctl status activemq
Here are the results you will get.
Step 4-Set the encrypted password for the web console
By default, authentication of the ActiveMQ web console is enabled, and all users and passwords of ActiveMQ are stored in “jetty-realm.properties” in plain text. For this step, we will use the encrypted password to change the default plain text password.
First, download and extract the terminal distribution.
wget --quiet https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.28.v20200408/jetty-distribution-9.4.28.v20200408.tar.gztar -xf jetty-distribution-*.tar.gz
Now go to the “jetty-distribution- *” directory.
cd jetty-distribution-*/
Run the following command to generate your password, and make 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
You will now receive the following response.
2020-04-29 07:15:22.367:INFO::main: Logging initialized @194ms to org.eclipse.jetty.util.log.StdErrLogmypasswordOBF:1uh41zly1x8g1vu11ym71ym71vv91x8e1zlk1ugmMD5:34819d7beeabb9260a5c854bc85b3e44CRYPT:myylAylKPNtmw
copy”Password: myy ... “The encrypted password on the note because it will be used for ActiveMQ.
Now go to the ActiveMQ configuration directory “/ opt / activemq / conf” and edit the configuration “jetty-realm.properties” using the vim editor.
cd /opt/activemq/conf/vim jetty-realm.properties
Change the default administrator password of the generated encrypted password “CRYPT: myy …” as follows.
admin: CRYPT:myylAylKPNtmw, adminuser: user, user
Save and close.
Next, restart the Apache ActiveMQ service to apply the new configuration.
systemctl restart activemq
As a result, the configuration of the ActiveMQ Web console using the encrypted password is completed.
Step 5-Test
Now, open a web browser and type the server IP address using port “8161”.
http: // serverip: 8161 /
Then, you will get the default index.html page of the ActiveMQ web console.
Next, add the “/ admin” path to the URL as shown below.
http: // serverip: 8161 / admin
And you will be prompted for ActiveMQ authentication.
Type the default user “admin” and generate your password at the top, then click “OK” to log in.
After the password is correct, you will get the ActiveMQ dashboard shown below.
As a result, the installation and configuration of Apache ActiveMQ on Debian Buster 10 has been successfully completed.