安裝java環境
/usr/java/jdk1.8.0_51
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_51
export CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
安裝apache-activemq
tar -zxvf apache-activemq-5.13.0-bin.tar.gz -C /usr/local/
mv /usr/local/apache-activemq-5.13.0/ /usr/local/activemq/
cd /usr/local/activemq/bin
啓動activemq服務
/usr/local/activemq/bin/activemq start
查看端口是否有運行程序
[root@localhost bin]# netstat -anpult | grep 61616
tcp 0 0 :::61616 :::* LISTEN
3576/java
完成後添加開啓自啓動
[root@localhost bin]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/usr/local/activemq/bin/activemq start
測試
配置好後可以登錄監控管理頁面去看隊列情況
http://192.168.100.15:8161/admin/queues.jsp
登錄時出現需要身份驗證,有兩種解決方案:
1.修改配置文件,不需要驗證,編輯jetty.xml文件
cd /usr/local/activemq/conf/
vi jetty.xml (property name="authenticate" value="true")改爲(property name="authenticate" value="false")
<bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
<property name="name" value="BASIC" />
<property name="roles" value="user,admin" />
<!-- set authenticate=false to disable login -->
<property name="authenticate" value="false" />
</bean>
2.添加用戶名和密碼,在conf目錄下找到jetty-realm.properties
vi jetty-realm.properties
# Defines users that can access the web (console, demo, etc.)
# username: password [,rolename ...]
admin: admin, admin (用戶名)
user: user, user (密碼)
兩種方法如果需要生效重啓activemq服務