activemq下载地址,http://activemq.apache.org/download.html,下载后解压,进入bin,直接运行 activemq start
bin/activemq start INFO: Loading '/usr/local/activemq/bin/env' INFO: Using java '/usr/local/jdk8/bin/java' INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details INFO: pidfile created : '/usr/local/activemq/data/activemq.pid' (pid '3880')
默认端口是61616,可以查看端口有没被占用
[root@localhost init.d]# netstat -an|grep 61616 tcp6 0 0 :::61616 :::* LISTEN
端口61616加入防火墙,后台管理端口8161也加入防火墙
firewall-cmd --zone=public --add-port=61616/tcp --permanent firewall-cmd --zone=public --add-port=8161/tcp --permanent firewall-cmd --reload
浏览器 访问http://192.168.249.71:8161/admin/,用户名/密码:admin/admin
把activemq加入系统服务并开机自启动cp /usr/local/activemq/bin/activemq /etc/init.d/activemqd
cd /etc/init.d/
vi activemqd
在#!/bin/sh下面添加以下代码
#### BEGIN INIT INFO # Provides: activemq # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 6 # chkconfig: 2345 64 36 # Short-Description: ActiveMQ server ### END INIT INFO export JAVA_HOME=/usr/local/jdk7#根据实际情况设置 ACTIVEMQ_HOME=/usr/local/activemq#根据实际情况设置
#加入系统服务并开机启动chmod +x activemqd chkconfig --add activemqd chkconfig activemqd on [root@localhost init.d]# service activemqd start INFO: Loading '/usr/local/activemq/bin/env' INFO: Using java '/usr/local/jdk8/bin/java' INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details INFO: pidfile created : '/usr/local/activemq/data/activemq.pid' (pid '4057')
java代码测试
来源:https://www.cnblogs.com/ystq/p/5973573.html