JMS server: ActiveMQ

Revision as of 12:00, 16 April 2014 by WikiFreak (talk | contribs) (Created page with "=Manual installation= ==Installation== ===Get Apache Active MQ=== Get the latest binary version from: ===Program setup=== * Copy ar...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Manual installation


Get Apache Active MQ

Get the latest binary version from:

Program setup

  • Copy archive to /opt/ directory:
mv /opt/
cd /opt/
  • Unzip and create simlink
ln -s /opt/apache-activemq-5.9.1/ /opt/activemq/
  • Set executable flag and symlinks
chmod 755 /opt/activemq/bin/activemq
ln -s /opt/activemq/bin/activemq /usr/bin/activemq
ln -s /opt/activemq/bin/activemq /etc/init.d/activemq

===Rights adjustments===
* Add non privileged account
<syntaxhighlight lang="bash">
adduser -system activemq
addgroup -system activemq
  • Adjust user shell


vim /etc/passwd

Adjust the user SHELL

  • Adjust user group


vim /etc/group

Adjust the group membership

  • Set MQ folder privileges
chown -R activemq:activemq /opt/apache-activemq-5.9.1/
chown -R activemq:activemq /opt/activemq/

Basic configuration

Home + User

  • Set home and user


vim /opt/apache/bin/activemq

Set after "Configuration" (line ~ 40)


Runtime configuration

  • Create runtime configuration. Generate default settings
/opt/activemq/bin/activemq setup /etc/default/activemq
  • Adjust configuration rights
chown root:nogroup /etc/default/activemq
chmod 600 /etc/default/activemq

Add ActiveMQ to boot sequence

cd /etc/init.d
update-rc.d activemq defaults

Remove ActiveMq from boot sequence

update-rc.d -f activemq remove
rm /etc/init.d/activemq

Setup firewall

This is the list of ports that are used by ActiveMQ:

  • port 61616 = JMS queue access
  • port 11099 = JMX remote console (connector port)
  • port 8161 = HTTP manager
  • port 8162 = HTTPS manager
  • port 5672 = AMQP port

Edit your firewall script:

vim /etc/firewall/

$IPTABLES -A INPUT -p tcp -m state --state NEW --dport 5672 -j ACCEPT
$IPTABLES -A INPUT -p tcp -m state --state NEW --dport 8161 -j ACCEPT
$IPTABLES -A INPUT -p tcp -m state --state NEW --dport 8162 -j ACCEPT
$IPTABLES -A INPUT -p tcp -m state --state NEW --dport 11099 -j ACCEPT
$IPTABLES -A INPUT -p tcp -m state --state NEW --dport 61616 -j ACCEPT

# Output
$IPTABLES -A OUTPUT -p tcp -m state --state NEW --dport 5672 -j ACCEPT 
$IPTABLES -A OUTPUT -p tcp -m state --state NEW --dport 8161 -j ACCEPT
$IPTABLES -A OUTPUT -p tcp -m state --state NEW --dport 8162 -j ACCEPT
$IPTABLES -A OUTPUT -p tcp -m state --state NEW --dport 11099 -j ACCEPT
$IPTABLES -A OUTPUT -p tcp -m state --state NEW --dport 61616 -j ACCEPT

Advanced Configuration (all O.S)

Broker settings

Edit configuration file

  • Linux ~ manual
vim /opt/activemq/conf/activemq.xml
  • Linux ~ auto
vim /etc/activemq/instances-enabled/main/activemq.xml
  • Windows


Adjust broker setting

  • Set broker name
<broker     xmlns=""
  • Set listener to all interfaces (
        <transportConnector name="openwire" uri="tcp://"/>
  • Limit queues size​
   <memoryUsage limit="64 mb"/>
   <storeUsage limit="100 gb"/>
   <tempUsage limit="50 gb"/>

Enable HTTP web console

Edit your jetty configuration

Linux ~ Manual

vim /opt/activemq/conf/jetty.xml
  • Windows


Adjust settings

At the bottom, edit connector :

<property name="connectors">
     <bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
         <property name="port" value="8161" />
         <property name="host" value="" />

Automatic installation

!! Depending on your distro, you might not have the web console !! This is NOT recommended.

Get binary

apt-get install activemq

Enable ActiveMQ broker

Create symlink

  1. cd /etc/activemq/instances-enabled/
  1. ls

By default you should have an instance enable.

If not:

  1. ln -s /etc/activemq/instances-available/main /etc/activemq/instances-enabled/main

Copy settings

  1. cp /usr/share/activemq/activemq-options /etc/activemq/instances-available/main/options

Edit settings

  1. vim /etc/activemq/instances-available/main/options
>> Adjust $INSTANCE (use 'main')

Create directories

  1. mkdir -p /var/lib/activemq/main/data
  2. mkdir -p /var/lib/activemq/main/data/kahadb > MQ embedded DB
  3. chown -R activemq:activemq /var/lib/activemq/main
  4. chmod -R 755 /var/lib/activemq/main