0%

centos下安装Activemq并设为开机启动服务

官网下载tar包

http://activemq.apache.org/components/classic/download/

安装activemq前提是要有JDK环境

1. 在安装目录下解压tar包

1
tar -zxvf apache-activemq-5.15.10-bin.tar.gz 

2. 进入解压后的文件夹,进入bin目录下:

1
2
3
[root@instance-d6rdm793 apache-activemq-5.15.10]# cd bin/
[root@instance-d6rdm793 bin]# ls
activemq activemq-diag activemq.jar env linux-x86-32 linux-x86-64 macosx wrapper.jar

3. ./activemq start 启动

1
2
3
4
5
[root@instance-d6rdm793 bin]# ./activemq start
INFO: Loading '/usr/activemq/apache-activemq-5.15.10//bin/env'
INFO: Using java '/usr/lib/jvm/java-1.8.0/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/activemq/apache-activemq-5.15.10//data/activemq.pid' (pid '20401')

4. ps -ef|grep activemq 查看

1
2
3
[root@instance-d6rdm793 bin]# ps -ef| grep activemq
root 20401 1 83 15:45 pts/0 00:00:08 /usr/lib/jvm/java-1.8.0/bin/java -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/usr/activemq/apache-activemq-5.15.10//conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/usr/activemq/apache-activemq-5.15.10//tmp -Dactivemq.classpath=/usr/activemq/apache-activemq-5.15.10//conf:/usr/activemq/apache-activemq-5.15.10//../lib/: -Dactivemq.home=/usr/activemq/apache-activemq-5.15.10/ -Dactivemq.base=/usr/activemq/apache-activemq-5.15.10/ -Dactivemq.conf=/usr/activemq/apache-activemq-5.15.10//conf -Dactivemq.data=/usr/activemq/apache-activemq-5.15.10//data -jar /usr/activemq/apache-activemq-5.15.10//bin/activemq.jar start
root 20442 20176 0 15:45 pts/0 00:00:00 grep activemq

安装完成!!!!!!!!!!!!

下面要把activemq设为系统服务,设置开机启动:

同之前的tomcat设置类似的操作,拷贝一份activemq启动文件到/etc/init.d目录下

1
cp /usr/activemq/apache-activemq-5.15.10/bin/activemq /etc/init.d/
1
cd etc/init.d/

查看init.d目录下:

20191125165115832

编辑activemq文件:

1
vi activemq 

添加如下配置:

1
2
3
4
5
6
7
8
9
10
11
### BEGIN INIT INFO
# Provides: activemq
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $network $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 6
# Short-Description: Starts ActiveMQ
# Description: Starts ActiveMQ Message Broker Server
### END INIT INFO
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
ACTIVEMQ_HOME=/usr/activemq/apache-activemq-5.15.10

export JAVA_HOME和ACTIVEMQ_HOME按实际目录写

20191125170053495.png

保存文件退出。

添加activemq到服务列表:

1
chkconfig --add activemq

查看是否添加成功:

1
chkconfig  --list

20191125170259390.png

好了,就可以使用service activemq start启动activemq,service activemq stop停止

最后,设置开机启动:
chkconfig activemq on

END!
————————————————
版权声明:本文为CSDN博主「WannaRunning」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_29569183/article/details/103239440