下载并安装
- 安装activemq之前首先要确定已经安装并配置好了JDK
- 去官网下载activemq最新版本,这里是apache-activemq-5.14.4-bin.tar.gz
- 解压activemq压缩包到制定文件夹
cp /home/apache-activemq-5.14.4-bin.tar.gz /usr/local/activemq
tar -zxvf apache-activemq-5.14.4-bin.tar.gz
mv apache-activemq-5.14.4 activemq-5.14.4
配置activemq开机启动
- 进入/etc/rc.d/init.d目录编辑activemq启动文件
cd /etc/rc.d/init.d
vi activemq
#添加以下内容到activemq文件中,注意要根据自己的jdk和activemq安装目录修改启动文件中JAVA_HOME和CATALINA_HOME配置参数
#!/bin/sh
#
# /etc/init.d/activemq
# chkconfig: 345 63 37
# description: activemq servlet container.
# processname: activemq 5.14.1
# Source function library.
#. /etc/init.d/functions
# source networking configuration.
#. /etc/sysconfig/network
export JAVA_HOME=/usr/java/jdk1.8.0_111
export CATALINA_HOME=/usr/local/activemq-5.14.4
case $1 in
start)
sh $CATALINA_HOME/bin/activemq start
;;
stop)
sh $CATALINA_HOME/bin/activemq stop
;;
restart)
sh $CATALINA_HOME/bin/activemq stop
sleep 1
sh $CATALINA_HOME/bin/activemq start
;;
esac
exit 0
# 给activemq文件赋执行权限
chmod +x activemq
#添加activemq到service服务中去
chkconfig --add activemq
#设置activemq为开机启动
chkconfig activemq on
#启动activemq
service activemq start