1. Download the installation package
Since RabbitMQ relies on the erlang environment, you need to install **erlang first. **
Enter the RabbitMQ official website to view the MQ version and supported erlang version information.
RabbitMQ Erlang Version Requirements — RabbitMQ
I hope to choose the latest version 3.12.12, then my corresponding erlang version should be **26.2.x **.
Download RabbitMQ installation package
https://github.com/rabbitmq/rabbitmq-server/releases
Download erlang installation package
Because my Linux is version 7, here is the installation package corresponding to version el7 and version 26.2.1.
https://github.com/rabbitmq/erlang-rpm/releases
2. Installation
File Upload
Upload the files to the /usr/local/software folder.
Installation files
- Install erlang environment
rpm -ivh erlang-26.2.1-1.el7.x86_64.rpm
-i installation command
-vh prints the installation progress, optional
- Install dependency packages. This step is to download content from the Internet, which requires the server to be able to connect to the external network.
yum install socat -y
- Install RabbitMQ
rpm -ivh rabbitmq-server-3.12.12-1.suse.noarch.rpm
3. Start/Stop
- Turn on auto-start
chkconfig rabbitmq-server on
- Check status
/sbin/service rabbitmq-server status
- Start
/sbin/service rabbitmq-server start
- Stop
/sbin/service rabbitmq-server stop
- Open the web management page (if it is not opened, there will be no web page)
rabbitmq-plugins enable rabbitmq_management
At this point you can access the web page. If you cannot access this website, the firewall may not be closed.
// View firewall status
systemctl status firewalld
// Turn off firewall
sytemctl stop firewalld
// Turn off firewall permanently
systemctl disable firewalld
Then you can access
At this time, the login prompt “User can only log in via localhost” is because the guest account has not been assigned web login permissions.
4. User management
View users and roles
rabbitmqctl list_users
See that there is only one guest user by default, and the role is administrator
Create an account
Here admin is the username and 123 is the password
rabbitmqctl add_user admin 123
Displaying the contents of the red box indicates that the addition is successful. The red box reminds you not to forget to set permissions.
Use the rabbitmqctl list_users command to see the newly added admin user.
Set user role
set_user_tags is to set the user role, admin is the user name, administrstor represents the administrator role
rabbitmqctl set_user_tags admin administrator
Set user permissions
set_permissions is to set user permissions, the “/” after -p is to specify vhostpath, **
rabbitmqctl set_permissions [-p <vhostpath>] <user> <conf> <write> <read>
// Example, This command means,Grant "/" vhost DownadminAll user configurations,Read and write permissions
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
You can log in successfully