Installation on Redhat Server

Installation on Redhat Server

Default Configuration

Variable

Default

Description

x.y.z

5.13.3

Current stable ActiveMQ version

ACTIVEMQ_HOME

/usr/local/apache-activemq-x.y.z

Installation directory

INSTANCE_NAME

broker

Name of broker - should maybe correlate with host name?

Installing ActiveMQ
  1. Download the latest stable ActiveMQ release (apache-activemq-x.y.z.tar.gz).

  2. Move to the installation root cd /usr/local.

  3. Unpack the release tar xzvf /path/to/apache-activemq-x.y.z.tar.gz

  4. Create ActiveMQ user account useradd activemq

  5. Optional: Edit the global configuration files vim /usr/local/apache-activemq-x.y.z/conf/{activemq,jetty}.xml before setting up instances.

  6. Optional: Setup service script

Configuring instances

For each broker instance:

  1. Switch to activemq account su - activemq

  2. If needed, create an instance wide setup file /usr/local/apache-activemq-x.y.z/bin/activemq setup ~activemq/.activemqrc. To use per instance activemqrc files (named ~/.activemqrc-instance-$(INSTANCE_NAME)) the start script used to start the instance must start with *activemq-instance-$(INSTANCE_NAME).

  3. Create broker instance configuration /usr/local/apache-activemq-x.y.z/bin/activemq create $(INSTANCE_NAME)

  4. Configure broker vim $(INSTANCE_NAME)/conf/{activemq,jetty}.xml

  5. Optional: Set up key and trust stores in $(INSTANCE_NAME)/conf/broker.{k,t}s

  6. Optional: Add broker to the service script, so that the broker may be automatically started on reboot.

Service/Init Script

For now see here

Later, something like this should work:

  1. chmod +x /etc/init.d/activemq

  2. chkconfig --add activemq

  3. chkconfig activemq on

  4. /etc/init.d/activemq start

# activemq-start.sh #!/bin/bash echo Starting ActiveMQ.... sh /home/activemq/test-broker-1/bin/test-broker-1 start sh /home/activemq/test-broker-2/bin/test-broker-2 start # activemq-stop.sh #!/bin/bash echo Stopping ActiveMQ.... sh /home/activemq/test-broker-1/bin/test-broker-1 stop sh /home/activemq/test-broker-2/bin/test-broker-2 stop # activemq #!/bin/bash # # activemq Starts ActiveMQ. # # chkconfig: 345 88 12 # description: ActiveMQ is a JMS Messaging Queue Server. ### BEGIN INIT INFO # Provides: $activemq ### END INIT INFO # Source function library. . /etc/init.d/functions [ -f /home/activemq/activemq-start.sh ] || exit 0 [ -f /home/activemq/activemq-stop.sh ] || exit 0 RETVAL=0 umask 077 start() { echo -n $"Starting ActiveMQ: " daemon su -c /home/activemq/activemq-start.sh activemq echo return $RETVAL } stop() { echo -n $"Shutting down ActiveMQ: " daemon su -c /home/activemq/activemq-stop.sh activemq echo return $RETVAL } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $?