mq安装

activemq是Apache出品,最流行的,能力强劲的开源消息总线.activemq是一个完全 支持JMS1.1和J2EE 1.4规范的 JMS Provider实现,尽管JMS规范出台已经是很久的事情了,但是JMS在当今的J2EE应用中间仍然扮演着特殊的地位.
  环境:centos 5.x
  需要的软件包:apache-activemq-5.9.0-bin.tar.gz
1.下载
 代码如下
复制代码
wget http://archive.apache.org/dist/activemq/apache-activemq/5.9.0/apache-activemq-5.9.0-bin.tar.gz
2.安装准备
在安装apache-activemq之前,必需要安装得有jdk环境,大家可以去看我这篇centos安装jdk 1.6文章.
3.安装activemq
 代码如下
复制代码
tar zxf apache-activemq-5.9.0-bin.tar.gz -C /usr/local/
mv /usr/local/apache-activemq-5.9.0 /usr/local/activemq
useradd activemq
chown -R activemq.activemq /usr/local/activemq
vi /usr/local/activemq/bin/activemq
更改ACTIVEMQ_OPTS_MEMORY的配置为ACTIVEMQ_OPTS_MEMORY="-Xms256M -Xmx384M -XX:PermSize=256M -XX:MaxPermSize=384M"
 代码如下
复制代码
XX:MaxPermSize=384M"
vi /etc/profile
export PATH=/usr/local/activemq/bin:$PATH
保存后,执行:
 代码如下
复制代码
source /etc/profile
配置自启动:
 代码如下
复制代码
vi /etc/init.d/activemq
 
#!/bin/bash
#
# activemq       Starts ActiveMQ.
#
#
# chkconfig: 345 88 12
# description: ActiveMQ is a JMS Messaging Queue Server.
### BEGIN INIT INFO
# Provides: $activemq
### END INIT INFO
 
# the base directory
AMQ_DIR="/usr/local/activemq"
 
# run the instance as user
AMQ_USER=activemq
 
CMD="nohup $AMQ_DIR/bin/activemq-admin"
 
case "$1" in
    start)
        echo "Starting ActiveMQ "
        /bin/su – $AMQ_USER -c "$CMD $1 >/dev/null 2>&1 &"
        ;;
     stop)
        echo "Shutting down ActiveMQ"
        /bin/su – $AMQ_USER -c "kill -9 `ps -u activemq -o pid=`"
        ;;
    restart)
        $0 stop
        $0 start
        ;;
    status)
        echo "you wish – not yet implemented"
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|status}"
    exit 1
 ;;
esac
保存并给与执行权限:
 代码如下
复制代码
chmod +x /etc/init.d/activemq
service activemq start
chkconfig activemq on
直接输入http://ip:8161/admin/index.jsp能正常访问,就可以了.

posted @ 2020-07-24 16:37  小鱼儿_summer  阅读(407)  评论(0编辑  收藏  举报