How To Install Apache ActiveMQ On CentOS

How To Install Apache ActiveMQ On CentOS




Today we are going to see how install Apache ActiveMQ on CentOS 7. So let's start.

Note:-  All command are executed by root privileges.

Step 1:- Install JAVA

ActiveMQ 5.x  need Java7 or greater. Here we are installing open jdk 8.

  yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel -y 

Use the command to check Java version

  java -version 

You can see output like

  
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b15)
OpenJDK 64-Bit Server VM (build 25.191-b15, mixed mode) 

Setup the JAVA_HOME environment

  vim /home/user/.bashrc 

Add below config in .bashrc file

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
export PATH=${M2_HOME}/bin:${JAVA_HOME}/bin:${PATH} 

Save & Close file. Source the .bashrc file.

:wq!

  source /home/user/.bashrc 

IF you already have java installed in your system then skip Step 1.

Step 2:- Install Apache ActiveMQ

You can get new and stable release of ActiveMQ from https://archive.apache.org/dist/activemq/ .

  
cd
wget https://archive.apache.org/dist/activemq/5.15.7/apache-activemq-5.15.7-bin.tar.gz
sudo tar -zxvf apache-activemq-5.15.7-bin.tar.gz -C /opt 

you can create a independent soft link pointing to the directory in which current release of Apache ActiveMQ resides.

  ln -s /opt/apache-activemq-5.15.7 /opt/activemq 

Step 3:- Create a systemd unit file for ActiveMQ

You can launch Apache ActiveMQ by running its executable file as shown in the following example.

  vim /usr/lib/systemd/system/activemq.service 

Add below config in file

 
[Unit]
Description=activemq message queue
After=network.target
[Service]
PIDFile=/opt/activemq/data/activemq.pid
ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop
User=root
Group=root
[Install]
WantedBy=multi-user.target 
 
Save and quit,

  :wq! 

Now start the sevrice of ActiveMQ

systemctl enable activemq.service
systemctl start activemq.service 

Step 4:-  Access the Apache ActiveMQ web console

If your firewalld service is already disable then skip below firewall settings.

If firewall service is enable the do below steps,

 
firewall-cmd --zone=public --permanent --add-port=8161/tcp
firewall-cmd --reload 

Now, point your web browser to http://youripaddress:8161/admin and log in using the default credentials.

  • username: admin
  • password: admin
 The username and password can be configured in the /opt/activemq/conf/jetty-real.properties file.

Now Apache ActiveMQ is ready to use. That's it !!! Please let me know your suggestions in comment box. If you like my blog then hit the like button. 
Thank You and see you in next blog.

Post a Comment

0 Comments