Centos7 install RabbitMQ 3.6.1

If you have read the first two chapters and have a certain understanding of RabbitMQ, and now you are ready to go, come and do it!

what system

This article uses Centos7 . In order to ensure that partners who are not familiar with linux can easily get started (to avoid folding on the way of installation), the following is the address of my system mirror: https://pan.baidu.com/s/1gfl6Y9l 
As a good habit, install the system and run the update:

yum update -y

reboot  //一般情况不用重启,个人习惯。
  • 1
  • 2
  • 3

Some people ask if I am a beginner can I use ubuntu? My answer is if you're using Centos for later production applications, it doesn't matter if you're just learning to play. Most of the production systems in my company (a Fortune 500 company, I won't name names) use Centos.

Install dependencies:

yum -y install gcc glibc-devel make ncurses-devel openssl-devel xmlto perl wget
  • 1

Install the erlang locale:

  • Download and install:
wget http://www.erlang.org/download/otp_src_18.3.tar.gz  //下载erlang包
tar -xzvf otp_src_18.3.tar.gz //解压 cd otp_src_18.3/ //切换到安装路径 ./configure --prefix=/usr/local/erlang //生产安装配置 make && make install //编译安装
  • 1
  • 2
  • 3
  • 4
  • 5
  • Configure erlang environment variables:
vi /etc/profile  //在底部添加以下内容
    #set erlang environment
    ERL_HOME=/usr/local/erlang
    PATH=$ERL_HOME/bin:$PATH export ERL_HOME PATH source /etc/profile //生效
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

To test whether the installation is successful, enter the command erl in the console

erl  //如果进入erlang的shell则证明安装成功,退出即可。
  • 1

Download and install RabbitMQ:

  • Download and install
cd /usr/local  //切换到计划安装RabbitMQ的目录,我这里放在/usr/local
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-generic-unix-3.6.1.tar.xz  //下载RabbitMQ安装包
xz -d rabbitmq-server-generic-unix-3.6.1.tar.xz tar -xvf rabbitmq-server-generic-unix-3.6.1.tar
  • 1
  • 2
  • 3
  • 4

After decompression, there is a folder rabbitmq-server-3.6.1, renamed rabbitmq for memory.

mv rabbitmq_server-3.6.1/ rabbitmq
  • 1
  • Configure rabbitmq environment variables:
vi /etc/profile
    #set rabbitmq environment
    export PATH=$PATH:/usr/local/rabbitmq/sbin
source /etc/profile
  • 1
  • 2
  • 3
  • 4
  • Start the service:
rabbitmq-server -detached //启动rabbitmq,-detached代表后台守护进程方式启动。
  • 1
  • 2

Check the status, if the following screenshot is displayed, the installation is successful:

rabbitmqctl status
  • 1

RabbitMQ Status

Other related commands

启动服务:rabbitmq-server -detached【 /usr/local/rabbitmq/sbin/rabbitmq-server  -detached 】 查看状态:rabbitmqctl status【 /usr/local/rabbitmq/sbin/rabbitmqctl status 】 关闭服务:rabbitmqctl stop【 /usr/local/rabbitmq/sbin/rabbitmqctl stop 】 列出角色:rabbitmqctl list_users
  • 1
  • 2
  • 3
  • 4

To configure the web plugin:

Create the directory first, otherwise an error may be reported:

mkdir /etc/rabbitmq
  • 1

Then enable the plugin:

rabbitmq-plugins enable rabbitmq_management
  • 1

Configure the firewall:

Configure linux port 15672 web management 5672 AMQP port:

firewall-cmd --permanent --add-port=15672/tcp firewall-cmd --permanent --add-port=5672/tcp systemctl restart firewalld.service
  • 1
  • 2
  • 3

Now you can enter the server IP: 15672 in the browser and you can see the RabbitMQ WEB management page. Are you excited, but you don't have an account and password, so don't worry. 
RabbitMQ WEB page management

Configure the access account password and permissions:

The default web page is not allowed to access, you need to add a user to modify the permissions, the code is as follows:

rabbitmqctl add_user superrd superrd  //添加用户,后面两个参数分别是用户名和密码,我这都用superrd了。
rabbitmqctl set_permissions -p / superrd ".*" ".*" ".*" //添加权限 rabbitmqctl set_user_tags superrd administrator //修改用户角色
  • 1
  • 2
  • 3

Then you can access it remotely, and then you can directly configure user permissions and other information. 
Login: http://ip:15672  After logging in, delete the guest in the admin. 
RabbitMQ delete guest user

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325247750&siteId=291194637