2020年 · Queues

CentOS 7下ActiveMQ安装配置

一、下载安装(安装前需要安装JDK1.8)
下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/activemq/
下载文件:apache-activemq-5.15.9-bin.tar.gz
安装:tar zxf apache-activemq-5.15.9-bin.tar.gz
mv apache-activemq-5.15.9 /usr/local/activemq

二、修改配置
指定JAVA_HOME位置,修改/usr/local/activemq/bin/env
JAVA_HOME=”/usr/java/jdk1.8.0_231″

修改密码,修改/usr/local/activemq/conf/jetty-realm.properties
默认为:
# Defines users that can access the web (console, demo, etc.)
# username: password [,rolename …]
admin: admin, admin
user: user, user

三、systemd自启动脚本
cat > /lib/systemd/system/activemq.service << EOF
[Unit]
Description=ActiveMQ service
After=network.target

[Service]
Type=forking
WorkingDirectory=/usr/local/activemq/data
ExecStart=/usr/local/activemq/bin/activemq start
ExecStop=/usr/local/activemq/bin/activemq stop
User=root
Group=root

[Install]
WantedBy=multi-user.target
EOF
systemctl enable activemq #开机自启动
systemctl start activemq #启动

四、安装成功后登录管理页面