演示环境: Centos8、jdk8、activemq5.15.8
下载地址:
http://activemq.apache.org/activemq-5158-release.html
http://mirror.centos.org/centos/
https://www.centos.org/
https://www.oracle.com/java/technologies/javase-jdk8-downloads.html
https://www.oracle.com/cn/java/technologies/javase-jdk8-downloads.html
解压: tar -zxvf apache-activemq-5.15.8-bin.tar.gz -C /var
修改目录名称 mv /var/apache-activemq-5.15.8/ /var/activemq/
启动: ./bin/activemq start
停止:./bin/activemq stop
1、创建一个systemd服务文件:vi /usr/lib/systemd/system/activemq.service
2、 放入内容
[Unit]
Description=ActiveMQ service
After=network.target
[Service]
Type=forking
ExecStart=/var/activemq/bin/activemq start
ExecStop=/var/activemq/bin/activemq stop
User=root
Group=root
Restart=always
RestartSec=9
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=activemq
[Install]
WantedBy=multi-user.target
3、 找到java命令所在的目录 whereis java
4、设置activemq配置文件/var/activemq/bin/env中的JAVA_HOME
# Location of the java installation
# Specify the location of your java installation using JAVA_HOME, or specify the
# path to the "java" binary using JAVACMD
# (set JAVACMD to "auto" for automatic detection)
JAVA_HOME="/usr/local/java/jdk1.8.0_181"
JAVACMD="auto"
5、 通过systemctl管理activemq启停
systemctl start activemq
systemctl status activemq
ln -s /usr/lib/systemd/system/activemq.service /etc/systemd/system/multi-user.target.wants/activemq.service
systemctl enable activemq
systemctl list-unit-files |grep activemq
6、 防火墙配置,Web管理端口默认为8161,通讯端口默认为61616
firewall-cmd --zone=public --add-port=8161/tcp --permanent
firewall-cmd --zone=public --add-port=61616/tcp --permanent
systemctl restart firewalld.service
systemctl stop firewalld.service
http://IP:8161/admin
默认用户名密码 admin/admin
1、设置ActiveMQ的访问密码,以提高ActiveMQ的安全性
2、在ActiveMQ的conf目录的activemq.xml中添加账号密码