How to Install Apache ActiveMQ on Ubuntu 18.04 | 16.04
How to Install Apache ActiveMQ on Ubuntu 18.04 | 16.04
Step-1
Install Java
(If already installed java please check the version before you installing )
Run this commands
1. sudo apt update
2. sudo apt-get install default-jre
After installing Java, the commands below can be used to verify whether Java is installed.
Run this command
3. java –version
You should see similar output as below:
output:openjdk version "11.0.5" 2019-10-15OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04, mixed mode, sharing)
Step 2:
Install Apache ActiveMQ
Now that Java is installed, run the commands below to download ActiveMQ from Apache office package repository. At the time of this writing, the current version was at 5.15.8.
Run this commands4. cd /tmp5. wget http://archive.apache.org/dist/activemq/5.15.8/apache- activemq-5.15.8-bin.tar.gz
After that, extract the downloaded folder and move its content to the /opt directory and create a folder called activemq
Run this commands6. tar -xvzf apache-activemq-5.15.8-bin.tar.gz7. sudo mv apache-activemq-5.15.8 /opt/activemq
To run ActiveMQ effectively, you’ll want to create a dedicated user and group accounts.. Simply run the commands below to create a username activemq as well as a group name.
Run this commands8. sudo addgroup --quiet --system activemq9. sudo adduser --quiet --system --ingroup activemq --no-create-home --disabled-password activemq
Next, change the ownership of the /opt/activemq directory so the user can have full control of content in there.
Run this command
10. sudo chown -R activemq:activemq /opt/activemq
After that, you will also want to create ActiveMQ systemd service so you can control starting, stopping and enabling its service.. To do that, simply run the commands below to create a service file.
Run this command
11. sudo nano /etc/systemd/system/activemq.service
Then copy the content below into the file and save it in that server
[Unit]Description=Apache ActiveMQAfter=network.target[Service]Type=forkingUser=activemqGroup=activemqExecStart=/opt/activemq/bin/activemq startExecStop=/opt/activemq/bin/activemq stop[Install]WantedBy=multi-user.target
After saving it, run the commands below to enable the service
Run this commands12. sudo systemctl daemon-reload13. sudo systemctl start activemq14. sudo systemctl enable activemq
To verify if the service is functioning, run the commands below to check it.
Run this command
15. /opt/activemq/bin/activemq status
You should see similar output as below:
Output:INFO: Loading '/opt/activemq//bin/env'INFO: Using java '/usr/bin/java'ActiveMQ is running (pid '5453')
After making changes to the file, restart ActiveMQ service by running the commands below:
Run this command
16. sudo systemctl restart activemq
inally, open your browser and browse to the server hostname or IP address followed by port 8161
Ex:
You should be prompted for a username and password. The default is admin / admin
Username: admin
Password: admin