preface


RabbitMQ installation tutorials (in various ways) can be found on their official website. Here I choose RPM to install RabbitMQ.

1. Install Erlang environment support


RabbitMQ is a high-performance message queue middleware developed in the Erlang language, so Erlang is required to install RabbitMQ.

A, theRabbitMQ official scriptQuick installation of Erlang

To install the Erlang environment, enter the following instructions in Linux

curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash
Copy the code

B. Verify whether the installation is successful

Enter the command in Linux:

erl
Copy the code

2. Install RabbitMQ


Follow the official tutorial here

A. Input the secret key:

rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc#
Copy the code

B. Download the RPM package to Linux:

Wget HTTP: / / https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.14/rabbitmq-server-3.7.14-1.el7.noarch.rpmCopy the code

C. Installation:

Yum install the rabbitmq server - 3.7.14-1. El7. Noarch. RPMCopy the code

D. Check whether the installation is successful

systemctl start rabbitmq-server
systemctl status rabbitmq-server 
Copy the code

3. Activate the RabbitMQ management plug-in to open the management page


Once installed, we can use a Web page to manage RabbitMQ

A. Activate the management plug-in

Switch to /usr/sbin
cd /usr/sbin
Use rabbitmq-plplugins for activation management
rabbitmq-plugins enable rabbitmq_management
Copy the code

At this point we turn on the admin function.

B. Enter http://server IP address :15672 in the browser

In this case, access failure may occur because the server port does not support access. You need to manually enable the following:

# check the firewall enabled port
firewall-cmd --list-ports
Enable port 15672
firewall-cmd --zone=public --add-port=15672/tcp --permanent
# restart firewall
systemctl restart firewalld
# Check the port to see if it is successfully added, then go to the browser to open the web page
firewall-cmd --list-ports
Copy the code

C. After opening the web page, we need to log in with the user name and password (need to add user)

Add user rabbitmqctl add_user username pass
rabbitmqctl  add_user nanshen nanshen
Rabbitmqctl set_user_tags username administrator
rabbitmqctl set_user_tags nanshen administrator
Rabbitmqctl set_permissions -p/username ".*" ".*" ".*"
rabbitmqctl set_permissions -p / nanshen ". *" ". *" ". *"
Copy the code

From here we can use the nanshen/nanshen account password to log in to the RabbitMQ web page administration page