Install and use RabbitMQ in Linux

1. Install the Erlang running environment

RabbitMQ depends on Erlang, so before installing RabbitMQ, you need to install Erlang first. It should be noted here that there are version dependencies between Erlang and RabbitMQ. For details, see: https://www.rabbitmq.com/which-erlang.html;
the versions used in this article are as follows:
RabbitMQ:3.10.7;Erlang:23.3.4.18
1. Download ealang: Erlang download address
2. Unzip: tar -zxvf otp_src_23.3.4.18.tar.gz
3. Install the environment that Erlang compilation depends on: yum install make gcc gcc-c++ build-essential openssl openssl-devel unixODBC unixODBC -devel kernel-devel m4 ncurses-devel
4. Create the erlang folder in the /usr/local directory. The compilation and installation of erlang is installed in bin and lib under /usr/local by default. Here we secretly go to /usr/ local/erlang for easy management
5. Enter the erlang folder: cd otp_src_23.3.4.18/; compile erlang: ./configure --prefix=/usr/local/erlang --without-javac; then install: make && make install; Insert image description here
installation successful
6. Configure erlang environment variables: vim /etc/profile; add the following configuration:
export ERLANG_HOME=/usr/local/erlang (choose your own path)
export PATH=$ {ERLANG_HOME}/bin:${PATH}
Insert image description here
7. Re-read the configuration file: source /etc/profile; test whether the installation is successful: erl
Insert image description here
successful

2. Install RabbitMq

1. Download RabbitMQ: Download address
1. Unzip: tar -xvf rabbitmq-server-generic-unix-3.10.7.tar.xz
2: Configure environment variables: vim /etc/profile; add the following configuration:
ABBITMQ_HOME=/home /RabbitMq/rabbitmq_server-3.10.7
PATH=$ {RABBITMQ_HOME}/sbin:${PATH}
Insert image description here

3. Re-read the configuration file: source /etc/profile;
4. Enter the RabbitMq directory: cd /home/RabbitMq/rabbitmq_server-3.10.7/sbin/; enable the web management interface plug-in: ./rabbitmq-plugins enable rabbitmq_management
5: , Start: ./rabbitmq-server -detached
6. Access the address + port number (default: 15672) in the browser; (note that the port needs to be opened, or the firewall must be turned off)
Insert image description hereRabbitMQ’s Username and Password default to guest/guest;
log in at this time Will prompt:
Insert image description here

Reason for the error: Since rabbitmq 3.3.0, it is prohibited to use guest/guest administrator rights to access other than localhost.
Solution 1: Enter the folder: cd /home/RabbitMq/rabbitmq_server-3.10.7/sbin/;
# Step 1: Add the root user and set the password
rabbitmqctl add_user root123456
#Step 2: Add the root user as the administrator role
rabbitmqctl set_user_tags rootadministrator
#Step 3: Set the permissions of the root user, specify the vhost allowed to access and write/read
rabbitmqctl set_permissions - p "/" root". " ". " ".*"
Solution 2: If you want to use guest/guest to access through a remote machine, you need to find rabbit in the /home/RabbitMq/rabbitmq_server-3.10.7/ebin directory. app file (the version used in this article does not have this file, so the first method is used to solve it), and {loopback_users, [<<“guest”>>]} in the file, delete the <<“guest”>> , modified to {loopback_users, []}, Note: {loopback_users, []}, the following comma cannot be deleted.
Insert image description here
Success!

Guess you like

Origin blog.csdn.net/asasasasasawqwqwqw/article/details/131055903