1、下载最新版本ActiveMQ
下载地址如下,目前最新版本为:apache-activemq-5.15.2-bin.tar.gz
http://activemq.apache.org/download.html
2、解压ActiveMQ
解压目录为:/home/zz/user/
tar -zvxf apache-activemq-5.15.2-bin.tar.gz
3、配置服务启动
在/etc/init.d 目录下新建 activemq 文件,内容如下:
#!/bin/bash
cd /home/zz/user/
start() {
echo "正在启动ActiveMQ服务..."
apache-activemq-5.15.3/bin/linux-x86-64/activemq start
echo "启动ActiveMQ服务完成。"
}
restart() {
echo "正在重新启动ActiveMQ服务..."
apache-activemq-5.15.3/bin/linux-x86-64/activemq restart
echo "重新启动ActiveMQ服务完成。"
}
stop() {
echo "正在关闭ActiveMQ服务..."
apache-activemq-5.15.3/bin/linux-x86-64/activemq stop
echo "关闭ActiveMQ服务完成。"
}
status() {
apache-activemq-5.15.3/bin/linux-x86-64/activemq status
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
status)
status $SNAME
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac
4、操作ActiveMQ
[zz@localhost software]$ service activemq start
[zz@localhost software]$ service activemq stop
[zz@localhost software]$ service activemq restart
[zz@localhost software]$ service activemq status
5、查看ActiveMQ运行状态
ActiveMQ管理界面:http://localhost:8161,默认管理员用户密码:admin/admin