======Install ActiveMQ======
This page shows how to install ActiveMQ on CentOS 6
=====Prerequisites=====
You must have a CentOS machine already set up in accordance with the the "[[linux:install_centos6|Install CentOS 6]]" guide.
=====Download=====
Download the latest Linux tar file from the [[http://activemq.apache.org/download.html|ActiveMQ website]] and put it in /tmp on the target server
=====Create Disk Partition=====
Run the following as root
lvcreate -L 1G datavg -n activemq
mkfs -t ext4 /dev/mapper/datavg-activemq
mkdir /activemq
echo '/dev/mapper/datavg-activemq /activemq ext4 defaults 1 2' >> /etc/fstab
mount -a
=====Setup User=====
useradd activemq
passwd activemq
=====Install=====
chown activemq:activemq /activemq/
su - activemq
cd /activemq/
tar xf apache-activemq-5.11.1-bin.tar.gz
ln -s apache-activemq-5.11.1 activemq
rm -f apache-activemq-5.11.1-bin.tar.gz
=====Configure=====
Enable the use of JMXThis will enable the use of some admin related commands when using /activemq/activemq/bin/activemq and /activemq/activemq/bin/activemq. The following commands are supported http://activemq.apache.org/activemq-command-line-tools-reference.html
vi /activemq/activemq/conf/activemq.xml
As root create /etc/init.d/activemq and put the following in the file
Set the managementContext element to True
Also, in the same file, edit
to
No configure the username/password in activemq by adding the following (change password value as appropriate) to /activemq/activemq/conf/jetty-realm.properties
Replace
admin: admin, admin
With
wsxadm: Password, admin
The format is "username: password, rolename"
As root create /etc/init.d/activemq and put the following in the file
#!/bin/bash
# chkconfig: 2345 95 20
# description: Script to Start | Restart activemq
case $1 in
start)
COMMAND="/activemq/activemq/bin/activemq start"
/bin/su activemq -c "$COMMAND"
;;
stop)
COMMAND="/activemq/activemq/bin/activemq stop"
/bin/su activemq -c "$COMMAND"
;;
restart)
COMMAND="/activemq/activemq/bin/activemq stop"
/bin/su activemq -c "$COMMAND"
COMMAND="/activemq/activemq/bin/activemq start"
/bin/su activemq -c "$COMMAND"
;;
esac
exit 0
chmod u+x /etc/init.d/activemq
chkconfig --add activemq
chkconfig activemq on
=====Open Firewall=====
By default, the admin page runs on port 8161. We put this behind the Nginx reverse proxy and access it over https on port 8162.
Open the firewall
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 8162-j ACCEPT
service iptables save
service iptables restart
Add the following at the end of /etc/nginx/conf.d/default.d (Change "internal" as appropriate).
server {
listen 8162;
server_name internal.example.com;
ssl on;
ssl_certificate /etc/nginx/conf.d/internal.crt;
ssl_certificate_key /etc/nginx/conf.d/internal.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2;
ssl_ciphers 'AES256+EECDH:AES256';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
#charset koi8-r;
access_log /var/log/nginx/log/host.access.log main;
location / {
proxy_pass http://mqadmin;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
proxy_set_header Host $host;
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
send_timeout 900;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Add the following to the top of /etc/nginx/conf.d/default.d
upstream mqadmin {
server 127.0.0.1:8161;
}
Restart Nginx
service nginx restart
You can now access the admin page on
https://internal.example.com:8162/admin/