欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

RabbitMQ安装

程序员文章站 2022-07-12 12:49:33
...

环境

系统:CentOS 7.4
软件:rabbitmq-server-generic-unix-3.7.4.tar.xz

准备

  • 安装Erlang
    # vim /etc/yum.repos.d/rabbitmq-erlang.repo
    [rabbitmq-erlang]
    name=rabbitmq-erlang
    baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7
    gpgcheck=1
    gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
    repo_gpgcheck=0
    enabled=1
    
    # yum install erlang
    

RabbitMQ安装

  • 下载二进制包
    地址:http://www.rabbitmq.com/install-generic-unix.html

    • 安装
    # tar -xJvf rabbitmq-server-generic-unix-3.7.4.tar.xz
    # mv rabbitmq_server-3.7.4 /usr/local/rabbitmq
    
    • 配置环境变量
    # vim /etc/profile
    export PATH=/usr/local/rabbitmq/sbin:$PATH
    
    # source /etc/profile
    

RabbitMQ启动

  • 编写启动服务

    # vim /usr/lib/systemd/system/rabbitmq.service
    [Unit]
    Description=RabbitMQ
    After=network.target
    
    [Service]
    User=root
    Type=forking
    ExecStart=/usr/local/rabbitmq/sbin/rabbitmq-server -detached
    ExecStop=/usr/local/rabbitmq/sbin/rabbitmqctl stop_app
    
    [Install]
    WantedBy=multi-user.target
    
    • 启动
    # systemctl enable rabbitmq.service
    # systemctl start rabbitmq.service
    

其他

  • 开启web管理插件

    # rabbitmq-plugins enable rabbitmq_management
    
  • 添加用户并授权

    # rabbitmqctl add_user YourName YourPassword
    # rabbitmqctl set_user_tags YourName administrator
    
  • 登陆web管理页
    http://ip:15672