二、ActiveMQ安装

1 下载

下载地址: http://activemq.apache.org/download.html

最新版5.15.1

2 安装和启动

环境准备:

IP:10.0.31.144

环境:CentOS 6.6

JDK:1.8

apache-activemq-5.11.1-bin.tar.gz

(1)安装JDK并配置环境变量

本机中已经预装了 export JAVA_HOME=/usr/java/jdk1.8.0_131

(2)下载或上传Linux版的ActiveMQ到/usr/local 目录

[[email protected] ~]# cd /usr/local/
[[email protected] local]# wget http://apache.fayea.com/activemq/5.11.1/apache-activemq-5.11.1-bin.tar.gz
....下载中..
[[email protected] local]# ll
总用量 55448
-rwxr-xr-x   1 root root 43399561 10月 23 11:12 apache-activemq-5.11.1-bin.tar.gz

(3)解压并重命名文件为activemq-5.11

[[email protected] local]# tar -zxvf apache-activemq-5.11.1-bin.tar.gz
[[email protected] local]# mv apache-activemq-5.11.1 activemq-5.11
[[email protected] local]# ll
总用量 55452
drwxr-xr-x  10 root root     4096 2月  14 2015 activemq-5.11

(4)如果启动脚本没有权限,此时需要授权(此步可选)

[[email protected] local]# cd /usr/local/activemq-5.11/bin
[[email protected] bin]# chmod 755 ./activemq

(5)启动activeMQ


[[email protected] local]# cd /usr/local/activemq-5.11/bin
[[email protected] bin]# ./activemq start

(6)访问ActiveMQ管理界面

打开电脑浏览器,输入 http://10.0.31.144:8161/ ActiveMQ入门到精通-ActiveMQ安装(单机)

点选Manage ActiveMQ broker ActiveMQ入门到精通-ActiveMQ安装(单机)

默认的用户名密码为:admin/admin,登陆后进入:ActiveMQ入门到精通-ActiveMQ安装(单机)

3 ActiveMQ安全配置

ActiveMQ 如果不加入安全机制的话,任何人只要知道消息服务的具体地址(包括 ip,端口,消息地址

[队列或者主题地址],),都可以肆无忌惮的发送、接收消息。

关于 ActiveMQ 安装配置官方指导文档: http://activemq.apache.org/security.html

1 添加新的用户密码:

以简单授权为例,配置新的用户名密码在 conf/activemq.xml中


[[email protected] bin]# pwd
/usr/local/activemq-5.11/bin
[[email protected] bin]# cd ..
[[email protected] activemq-5.11]# cd conf/
[[email protected] conf]# vim activemq.xml

在 broker 标签最后加入以下内容即可:


<plugins>     
  <simpleAuthenticationPlugin>     
    <users>         
      <authenticationUser username="chen" password="chen123" groups="users,admins"/>     
    </users>     
  </simpleAuthenticationPlugin>
</plugins>

定义了一个 chen 用户,密码为chen123,角色为 users,admins

2 修改admin用户的密码:

(1)编辑conf/jetty.xml


[[email protected] conf]# pwd
/usr/local/activemq-5.11/conf
[[email protected] conf]# vim jetty.xml

确保 authenticate 的值为 true(默认)

(2)控制台的登录用户名密码保存在 conf/jetty-realm.properties 文件中,内容如下:


[[email protected] conf]# vim jetty-realm.properties

修改为admin: admin123, admin chen: chen123, user

解释:用户名:密码,角色

(3)重启


/home/wusc/activemq-01/bin/activemq restart

4 设置开机启动:


[[email protected] ~]# vi /etc/rc.local

加入以下内容

ActiveMQ

su - root -c '/usr/local/activemq-5.11/bin/activemq start'

相关文章:

  • 2021-11-02
  • 2021-11-18
  • 2021-04-08
  • 2021-09-06
  • 2021-06-02
猜你喜欢
  • 2021-11-20
  • 2021-08-31
  • 2021-09-30
相关资源
相似解决方案