1 RabbitMQ安装

1 Windows下安装

1.1 安装Erlang

类似于java开发需要jdk,RabbitMQ开发需要Erlan
直接下一步即可,安装目录不建议切换

1.2 安装RabbitMQ

直接点击下一步,安装目录不建议切换

1.3 启动RabbitMQ

打开RabbitMQ Command Prompt (sbin dir)
执行命令
    rabbitmq-plugins enable rabbitmq_management
1 RabbitMQ安装_第1张图片
安装Web管理界面插件

1.4 检验是否安装成功

输入地址
    http://127.0.0.1:15672/
账号:guest 密码:guest
1 RabbitMQ安装_第2张图片
RabbitMQ首页

2 Linux下安装

2.1 安装erlang

# 切换到安装目录,创建rabbitmq目录
[root@root ~]# cd /usr/local/src/
[root@root src]# mkdir rabbitmq
[root@root src]# cd rabbitmq/

# 下载erlang,提示wget命令未找到
[root@root rabbitmq]# wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
-bash: wget: command not found

# 安装wget命令
[root@root rabbitmq]# yum -y install wget

# 下载erlang
[root@root rabbitmq]# wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm

# 安装erlang,提示需要epel-release
[root@root rabbitmq]# rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
error: Failed dependencies:
    epel-release is needed by erlang-solutions-1.0-1.noarch

# 安装epel-release
[root@root rabbitmq]# yum install epel-release

# 安装erlang所需环境
[root@root rabbitmq]# rpm -Uvh erlang-solutions-1.0-1.noarch.rpm 
[root@root rabbitmq]# rpm --import http://packages.erlang-solutions.com/rpm/erlang_solutions.asc

# 安装erlang报错
[root@root rabbitmq]# yum -y install erlang
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

# 修改配置文件
[root@root rabbitmq]# vi /etc/yum.repos.d/epel.repo
    将
        [epel]
        name=Extra Packages for Enterprise Linux 6 - $basearch
        #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
        mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
    修改为
        [epel]
        name=Extra Packages for Enterprise Linux 6 - $basearch
        baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
        #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

# 再次安装erlang
[root@root rabbitmq]# yum -y install erlang

# 安装完成后可以用erl命令查看是否安装成功
[root@root rabbitmq]# erl -version
Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 8.3

2.2 安装RabbitMQ Server

# 下载
[root@root rabbitmq]# wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.1/rabbitmq-server-3.5.1-1.noarch.rpm

# 安装
[root@root rabbitmq]# rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
[root@root rabbitmq]# yum install rabbitmq-server-3.5.1-1.noarch.rpm

# RabbitMQ随系统启动
[root@root rabbitmq]# chkconfig rabbitmq-server on

# 启动RabbitMQ服务
[root@root rabbitmq]# /sbin/service rabbitmq-server start

# 安装Web管理界面插件
[root@root rabbitmq]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management

# 创建账号
[root@root rabbitmq]# rabbitmqctl add_user gp6  123456

# 设置用户角色
[root@root rabbitmq]# rabbitmqctl  set_user_tags  gp6  administrator

# 设置用户权限
[root@root rabbitmq]# rabbitmqctl set_permissions -p "/" gp6 ".*" ".*" ".*"

# 查看当前用户和角色(需要开启服务)
[root@root rabbitmq]# rabbitmqctl list_users

2.3 访问RabbitMQ管理页面

访问
    192.168.1.16:15672
将192.168.1.16替换成RabbitMQ服务器所在IP(注意防火墙)
1 RabbitMQ安装_第3张图片
RabbitMQ首页

你可能感兴趣的:(1 RabbitMQ安装)