ActiveMQ 单节点的安装


下在地址:http://apache.fayea.com/activemq/5.13.3/apache-activemq-5.13.3-bin.tar.gz


1.配置环境变量jdk

 

  1.1 解压JDK

 

      tar -zvxf jdk-7u79-linux-x64.tar.gz


      mv jdk1.7.0_79/ /usr/local/java/


  1.2 编辑环境变量文件

   

     vim /etc/profile


     #文件最后部分加入


export JAVA_HOME=/usr/local/java

export JRE_HOME=${JAVA_HOME}/jre

export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib

export PATH=${JAVA_HOME}/bin:$PATH


   1.3 #刷新profiley文件


     source /etc/profile


   1.4 查看JDK版本


     java -version  


2.解压


[root@localhost ~]# tar zxvf apache-activemq-5.13.3-bin.tar.gz 


3.移动解压文件到/usr/local下并重命名


[root@localhost ~]# mv apache-activemq-5.13.3 /usr/local/activemq


4.启动activemq


[root@localhost ~]# cd /usr/local/activemq/bin


[root@localhost bin]# ./activemq start


INFO: Loading '/usr/local/activemq//bin/env'

INFO: Using java '/usr/local/java/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 '992')


5.检查端口是否监听


[root@localhost bin]# netstat -anplt | grep 61616



6.优化设置为开机自启动



方法一:


[root@localhost activemq]# ln -s /usr/local/activemq/bin/activemq /etc/init.d/

[root@localhost bin]#  vi  /usr/local/activemq/bin/activemq


# 第二行插入


# chkconfig: 2345 63 37


# description: Auto start ActiveMQ


[root@localhost bin]# chkconfig --add activemq

[root@localhost bin]# chkconfig activemq on


方法二:


 vim /etc/init.d/activemq 


#!/bin/sh

# activemq

# chkconfig: 345 63 37

# description: activemq 

. /etc/rc.d/init.d/functions

. /etc/sysconfig/network

case $1 in

start)

sh /usr/local/ActiveMQ/bin/activemq start

;;

stop)

sh /usr/local/ActiveMQ/bin/activemq stop

;;

status)

sh /usr/local/ActiveMQ/bin/activemq status

;;

restart)

sh /usr/local/ActiveMQ/bin/activemq stop

sh /usr/local/ActiveMQ/bin/activemq start

;;

esac

exit 0


添加执行权限

  chmod +x /etc/init.d/activemq-node1


添加系统服务,设为开机自启


chkconfig --add activemq 

chkconfig activemq  on 


7.在客户端验证


http://ip:8161    说明active的服务端的端口号为61616  监控端的端口号为8161