sky_cheng

导航

 

一、首先需要安装jdk

linux安装jdk以及tomcat 

二、下载二进制安装包

wget --no-check-certificate https://dlcdn.apache.org//activemq/5.16.3/apache-activemq-5.16.3-bin.tar.gz

三、解压到指定/usr/local目录下

[root@localhost bin]#  tar -zxvf /usr/local/src/apache-activemq-5.16.3-bin.tar.gz -C /usr/local/ --no-same-owner 

四、运行

[root@localhost bin]# /usr/local/apache-activemq-5.16.3/bin/activemq start
INFO: Loading '/usr/local/apache-activemq-5.16.3//bin/env'
INFO: Using java '/usr/local/jdk1.8.0_251/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/usr/local/apache-activemq-5.16.3//data/activemq.pid' (pid '15734')
[root@localhost bin]# 

五、查看状态

[root@localhost bin]# /usr/local/apache-activemq-5.16.3/bin/activemq status
INFO: Loading '/usr/local/apache-activemq-5.16.3//bin/env'
INFO: Using java '/usr/local/jdk1.8.0_251/bin/java'
ActiveMQ is running (pid '15734')
[root@localhost bin]# 

六、停止

[root@localhost bin]# /usr/local/apache-activemq-5.16.3/bin/activemq stop
INFO: Loading '/usr/local/apache-activemq-5.16.3//bin/env'
INFO: Using java '/usr/local/jdk1.8.0_251/bin/java'
INFO: Waiting at least 30 seconds for regular process termination of pid '15734' : 
Java Runtime: Oracle Corporation 1.8.0_251 /usr/local/jdk1.8.0_251/jre
  Heap sizes: current=62976k  free=61992k  max=932352k
    JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/usr/local/apache-activemq-5.16.3//conf/login.config -Dactivemq.classpath=/usr/local/apache-activemq-5.16.3//conf:/usr/local/apache-activemq-5.16.3//../lib/: -Dactivemq.home=/usr/local/apache-activemq-5.16.3/ -Dactivemq.base=/usr/local/apache-activemq-5.16.3/ -Dactivemq.conf=/usr/local/apache-activemq-5.16.3//conf -Dactivemq.data=/usr/local/apache-activemq-5.16.3//data
Extensions classpath:
  [/usr/local/apache-activemq-5.16.3/lib,/usr/local/apache-activemq-5.16.3/lib/camel,/usr/local/apache-activemq-5.16.3/lib/optional,/usr/local/apache-activemq-5.16.3/lib/web,/usr/local/apache-activemq-5.16.3/lib/extra]
ACTIVEMQ_HOME: /usr/local/apache-activemq-5.16.3
ACTIVEMQ_BASE: /usr/local/apache-activemq-5.16.3
ACTIVEMQ_CONF: /usr/local/apache-activemq-5.16.3/conf
ACTIVEMQ_DATA: /usr/local/apache-activemq-5.16.3/data
Connecting to pid: 15734
Stopping broker: localhost
.. FINISHED
[root@localhost bin]#

 

七、ActiveMQ的目录格式

  * LICENSE——包含ActiveMQ所使用库的license。

  * NOTICE——它包含ActiveMQ使用库的版权信息

  * README.txt——新手文档

  * webConsole-README.txt——包含使用ActiveMQWeb Conslole的信息。

  * activemq-all-5.3.0.jar——包含了ActiveMQ所有内容;方便使用它,在使用activeMQ的地方直接导入这一个jar包就够了。

  * bin——包含了ActiveMQ的二进制/可执行文件;启动脚本也在该目录下

  * conf——持有ActiveMQ所有配置信息

  * data——日志文件和消息持久数据保存在此目录下。

  * docs——包含一个简单的index.html文件,它指向ActiveMQ网址

  * example——示例;我们将用它来快速测试ActiveMQ

  * lib——lib目录持有所有ActiveMQ所需的库

  * user-guide.html——启动ActiveMQ和运行示例的简短指南

  * webapps——webapps目录持有ActiveMQ web console和一些其它web相关的demo

 八、修改web管控台配置

修改默认端口8161

[root@localhost conf]# vim /usr/local/apache-activemq-5.16.3/conf/jetty.xml 
    <bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
             <!-- the default port number for the web console -->
        <property name="host" value="127.0.0.1"/>
        <property name="port" value="8161"/>
    </bean>

修改默认登录用户名和密码

ActiveMQ的web管控台使用的是jetty服务器,所以需要修改jetty.xml

[root@localhost conf]# vim /usr/local/apache-activemq-5.16.3/conf/jetty.xml 

    <bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
        <property name="name" value="BASIC" />
        <property name="roles" value="user,admin" />
        <!-- set authenticate=false to disable login -->
        <property name="authenticate" value="true" />
    </bean>

将   <property name="authenticate" value="true" /> 设置为true

修改默认用户名和密码,用户名和密码保存在jetty-realm.properties配置文件里

[root@localhost conf]# vim /usr/local/apache-activemq-5.16.3/conf/jetty-realm.properties 
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements.  See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License.  You may obtain a copy of the License at
## 
## http://www.apache.org/licenses/LICENSE-2.0
## 
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------

# Defines users that can access the web (console, demo, etc.)
# username: password [,rolename ...]
admin: admin, admin
user: user, user

这里默认的用户是admin,密码也是admin ,角色为admin

这里的格式为:用户: 密码, 角色名

username: password [,rolename ...]

设置完保存退出,并重启activemq配置生效

 

posted on 2021-12-09 15:30  sky_cheng  阅读(249)  评论(0编辑  收藏  举报