Skip to content

Instantly share code, notes, and snippets.

@xmesaj2
Last active December 22, 2022 00:44
Show Gist options
  • Save xmesaj2/f28870ad8a280f4477f7ba791d938d8e to your computer and use it in GitHub Desktop.
Save xmesaj2/f28870ad8a280f4477f7ba791d938d8e to your computer and use it in GitHub Desktop.
ActiveMQ Artemis Ubuntu 20.04

Install

https://docs.azul.com/core/zulu-openjdk/install/debian

java -version

ARTEMIS_VER=2.27.1
CLUSTER=discordlogbot-cluster

wget https://dlcdn.apache.org/activemq/activemq-artemis/$ARTEMIS_VER/apache-artemis-$ARTEMIS_VER-bin.tar.gz
sudo tar -xvzf apache-artemis-$ARTEMIS_VER-bin.tar.gz
sudo mkdir /opt/activemq
sudo mv apache-artemis-$ARTEMIS_VER/* /opt/activemq
sudo addgroup --quiet --system activemq
sudo adduser --quiet --system --ingroup activemq --no-create-home --disabled-password activemq
sudo chown -R activemq:activemq /opt/activemq
cd /var/lib 
sudo /opt/activemq/bin/artemis create $CLUSTER --user=artemis --password=artemis --http-host 0.0.0.0 --relax-jolokia
sudo chown -R activemq:activemq /var/lib/$CLUSTER
sudo /var/lib/$CLUSTER/bin/artemis run
sudo vim /etc/systemd/system/activemq.service
[Unit]
Description=Apache ActiveMQ Artemis
After=network.target
[Service]
Type=forking
User=activemq
Group=activemq
ExecStart=/var/lib/discordlogbot-cluster/bin/artemis-service start
ExecStop=/var/lib/discordlogbot-cluster/bin/artemis-service stop
ExecReload=/var/lib/discordlogbot-cluster/bin/artemis-service restart
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start activemq
journalctl -xeu activemq
ls -la

Update

java -version

OLD_ARTEMIS_VER=2.27.0
ARTEMIS_VER=2.27.1
CLUSTER=discordlogbot-cluster

wget https://dlcdn.apache.org/activemq/activemq-artemis/$ARTEMIS_VER/apache-artemis-$ARTEMIS_VER-bin.tar.gz
sudo tar -xvzf apache-artemis-$ARTEMIS_VER-bin.tar.gz
sudo mv /opt/activemq /opt/activemq-$OLD_ARTEMIS_VER
sudo mkdir /opt/activemq
sudo mv apache-artemis-$ARTEMIS_VER/* /opt/activemq
sudo chown -R activemq:activemq /opt/activemq
cd /var/lib
sudo mv /var/lib/$CLUSTER/* /var/lib/$CLUSTER-
sudo /opt/activemq/bin/artemis create $CLUSTER
sudo chown -R activemq:activemq /var/lib/$CLUSTER-$OLD_ARTEMIS_VER
sudo vim /var/lib/$CLUSTER/etc/bootstrap.xml

change localhost to 0.0.0.0

sudo nano /var/lib/$CLUSTER/etc/jolokia-access.xml 

change allow-origin to:

*://*
sudo systemctl start activemq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment