Linux中安装ActiveMQ 配置开机自启动教程

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_30180559/article/details/79563459

一、安装ActiveMQ


1.解压activemq压缩包,重命名文件夹

# cd /usr/local
# tar -zxvf apache-activemq-5.11.1-bin.tar.gz
# mv apache-activemq-5.11.1 activemq
  • 1
  • 2
  • 3

2.防火墙开启activemq端口8161(管理平台端口)和61616(通讯端口) 【注:如果是云服务器的话 直接在安全端口配置上这俩端口即可

# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8161 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 61616 -j ACCEPT
  • 1
  • 2
  • 3

3.启动、访问、查看状态和停止activemq服务

# ./activemq/bin/activemq start
# wget 192.168.2.137:8161
# ./activemq/bin/activemq status
# ./activemq/bin/activemq stop
  • 1
  • 2
  • 3
  • 4

二、activemq注册为系统服务,开启开机自启


1.建立软连接

# ln -s /usr/local/activemq/bin/activemq /etc/init.d/
  • 1

2.注册为系统服务

# vi /etc/init.d/activemq
  • 1
  • 添加下面内容到/etc/init.d/activemq脚本
# chkconfig: 345 63 37
# description: Auto start ActiveMQ
JAVA_HOME=/usr/local/jdk1.8.0_144
JAVA_CMD=java
  • 1
  • 2
  • 3
  • 4

3.开启开机自启

# chkconfig activemq on
# reboot
  • 1
  • 2

4.可以以系统服务的方式启动、查看状态和停止服务

# service activemq start
# service activemq status
# service activemq stop

猜你喜欢

转载自blog.csdn.net/qq_30180559/article/details/79563459
今日推荐