Using ActiveMQ > Getting Started
This document describes how to install and configure ActiveMQ 4.x/5.x for both Unix and Windows' platforms.
The Getting Started Guide for ActiveMQ 4.x document contains the following sections:
Hardware:
`Operating Systems:**
Environment:
This section of the Getting Started Guide explains how to install binary and source distributions of ActiveMQ on a Windows system.
This procedure explains how to download and install the binary distribution on a Windows system.
This procedure explains how to download and install the source distribution on a Windows system.
Download the latest release
(see Download -> “The latest stable release” -> “apache-activemq-x.x.x-source-release.zip”)
Extract ActiveMQ from the ZIP file into a directory of your choice.
The recommended method of building ActiveMQ is the following:
REM add "-Dmaven.test.skip=true" if tests are failing on your system (should not happen) mvn clean install
where [activemq_install_dir]
is the directory in which ActiveMQ was installed.
If you prefer to use an IDE, then you can auto-generate the IDE's project file using maven plugins:
mvn eclipse:eclipse
or
mvn idea:idea
Feel free to use any other applicable IDE. Please refer to the plugin reference for more details.
Start ActiveMQ from the target directory, for example:
cd [activemq_install_dir]\assembly\target unzip activemq-x.x-SNAPSHOT.zip cd activemq-x.x-SNAPSHOT bin\activemq
NOTE: Working directories get created relative to the current directory. To create the working directories in the proper place, ActiveMQ must be launched from its home/installation directory.
Proceed to the #Testing the Installation section.
Warning
If you are building ActiveMQ 4.x under Windows using Cygwin there is a path name length limitation. If the path name length is exceeded, you may see build errors. To correct this, move the ActiveMQ source directory higher in the file system tree, e.g., /cygdrive/c/d/sm.
This procedure explains how to download and install the latest developer's snapshot.
This procedure explains how to download and install the binary distribution on a Unix system.
NOTE: There are several alternative ways to perform this type of installation.
Download the activemq zipped tarball file to the Unix machine, using either a browser or a tool, i.e., wget, scp, ftp, etc. for example:
(see Download -> “The latest stable release”)
wget http://activemq.apache.org/path/tofile/apache-activemq-x.x.x-bin.tar.gz
Extract the files from the zipped tarball into a directory of your choice. For example:
cd [activemq_install_dir] tar zxvf activemq-x.x.x-bin.tar.gz
Proceed to the #Starting ActiveMQ section of this document.
Following start-up, go to the #Testing the Installation section.
If you use OSX as your platform, you can use Homebrew package manager to easily install Apache ActiveMQ.
$ brew install apache-activemqYou can expect the following output:
==\> Downloading http://www.gossipcheck.com/mirrors/apache/activemq/apache-activemq/x.x.x/apache-activemq-x.x.x-bin.tar.gz ######################################################################## 100.0% ==\> Caveats Software was installed to: /usr/local/Cellar/apache-activemq/x.x.x/libexec ==\> Summary /usr/local/Cellar/apache-activemq/x.x.x: 406 files, 35M, built in 2 seconds
ActiveMQ will be installed in /usr/local/Cellar/apache-activemq/x.x.x/
directory (where x.x.x
denotes the actual version being installed).
Now you can proceed to #Starting ActiveMQ and #Testing the Installation sections.
This procedure explains how to download and install the source distribution on a Unix system. This procedure assumes the Unix machine has a browser. Please see the previous #Unix Binary Installation section for details on how to install ActiveMQ without a browser.
Download the latest source release
(see Download -> “The latest stable release” -> “activemq-parent-x.x.x-source-release.zip”)
Extract the files from the ZIP file into a directory of your choice. For example:
tar zxvf activemq.x.x-src.tar.gz
Build ActiveMQ using Maven:
The preferred method of building ActiveMQ is the following:
cd [activemq_install_dir] mvn clean install # add "-Dmaven.test.skip=true" if tests are failing on your system (should not happen)
If Maven crashes with a java.lang.OutOfMemoryError, you you need to do this first (assuming a Bourne-like shell):
export MAVEN_OPTS="-Xmx512M"
If you prefer to use an IDE then you can auto-generate the IDE's project file using maven plugins:
mvn eclipse:eclipse
or
mvn idea:idea
Feel free to use any other applicable IDE. Please refer to the plugin reference for more details.
NOTE: Working directories get created relative to the current directory. To create working directories in the proper place, ActiveMQ must be launched from its home/installation directory.
Proceed to the #Starting ActiveMQ section of this document.
Proceed to #Testing the Installation section.
This procedure explains how to download and install the latest developer's snapshot.
activemq-x.x.x-tar.gz
.tar zxvf activemq-x.x.x.tar.gzFor a source developer's snapshot:
tar zxvf activemq-x.x.x-src.tar.gz
ActiveMQ
script may need its permissions changed:cd [activemq_install_dir]/bin chmod 755 activemq
There now follows instructions on how to run the ActiveMQ Message Broker.
From a console window, change to the installation directory and run ActiveMQ
:
cd [activemq_install_dir]
where [activemq_install_dir]
is the directory in which ActiveMQ was installed, e.g., c:\Program Files\ActiveMQ-5.x
.
Then type:
bin\activemq start
`NOTE:** Working directories get created relative to the current directory. To create working directories in the proper place, ActiveMQ must be launched from its home/installation directory.
From a command shell, change to the installation directory and run ActiveMQ
as a foregroud process:
cd [activemq_install_dir]/bin ./activemq console
From a command shell, change to the installation directory and run ActiveMQ
as a daemon process:
cd [activemq_install_dir]/bin ./activemq start
For other ways of running the broker see Here. For example you can run an embedded broker inside your JMS Connection to avoid starting a separate process.
If ActiveMQ is up and running without problems, the Window's console window or the Unix command shell will display information similar to the following log line (see stdout output or “[activemq_install_dir]/data/activemq.log”):
Apache ActiveMQ 5.11.1 (localhost, ID:ntbk11111-50816-1428933306116-0:1) started | org.apache.activemq.broker.BrokerService | main
ActiveMQ's default port is 61616. From another window run netstat and search for port 61616.
From a Windows console, type:
netstat -an|find "61616"
OR
From a Unix command shell, type:
netstat -nl|grep 61616
You can monitor ActiveMQ using the Web Console by pointing your browser at http://localhost:8161/admin
.
From ActiveMQ 5.8 onwards the web apps is secured out of the box.
The default username and password is admin/admin. You can configure this in the conf/jetty-real.properties file.
Or you can use the JMX support to view the running state of ActiveMQ.
For more information see the file docs/WebConsole-README.txt
in the distribution.
For both Windows and Unix installations, terminate ActiveMQ by typing “CTRL-C” in the console or command shell in which it is running.
If ActiveMQ was started in the background on Unix, the process can be killed, with the following:
cd [activemq_install_dir]/bin ./activemq stop
The ActiveMQ broker should now run. You can configure the broker by specifying an Xml Configuration file as a parameter to the activemq command. An alternative is to use the Broker Configuration URI to configure things on the command line in a concise format (though the configuration options are not as extensive as if you use Java or XML code). You can also
Also see Configuring Transports to see how you can configure the various connection, transport and broker options using the connection URL in the ActiveMQConnectionFactory.
See the Initial Configuration for details of which jars you need to add to your classpath to start using ActiveMQ in your Java code
If you want to use JNDI to connect to your JMS provider then please view the JNDI Support. If you are a Spring user you should read about Spring Support
After the installation, ActiveMQ is running with a basic configuration. For details on configuring options, please see refer to the Configuration section.
If you are new to using ActiveMQ, running the Web Samples or the Examples is a good next step to learn more about ActiveMQ.
The Commercial Providers listed on the Support page may also have additional documentation, examples, tutorials, etc... that can help you get started.