Record of pit construction in Centos7 environment of Rabbit learning

Installation instructions

There are many ways to install rabbitmq. Developers who do not understand the official website documents may encounter many problems in the actual installation. This article will demonstrate CentOS 7 X version, how to install.

The installation method is to use the rpm package for installation. The dependent packages required for installation are erlang and socat respectively. Because rabbitmq was developed by erlang, this environment is needed. Socat is a network communication tool. The internal communication of rabbitmq depends on this package, so the dependency library also needs to be installed.

The installation method introduced in this article is based on CentOS 7 X new environment. The problems encountered in different environments will be different. This paper is for reference.

Installation preparation

Open the rpm installation package download website. I use packagecloud io. The following interface will appear. We just need to download erlang and rabbitmq.

Snipaste_2021-12-05_12-14-03

Find the appropriate version, click the package name, and you will jump to an interface similar to the following. The version installed in this article is:

erlang edition: erlang-23.3.4.4-1.el7.x86_64.rpm
rabbitmq edition: rabbitmq-server-3.8.26-1.el7.noarch.rpm

Snipaste_2021-12-05_12-15-31

After seeing the above interface, we can directly click the download button in the upper right corner to download the rpm package locally, and then you can upload it to the server.

Through curl, you will find that it is very slow, so the method of this article is recommended.

install

First we install erlang, then socat, and finally rabbitmq. If you do not install the first two, you will also be prompted to install rabbit. Similar to the following error message:

Warning: rabbitmq-server-3.8.26-1.el7.noarch.rpm: head V4 RSA/SHA512 Signature, secret key ID 6026dfca: NOKEY
 Error: dependency detection failed:
 socat cover rabbitmq-server-3.8.26-1.el7.noarch need
rpm erlang-23.3.4.4-1.el7.x86_64.rpm
yum install socat

The following information may be prompted when installing socat. At this time, an error will be reported that there is no socat package or the socat package cannot be found. Execute Yum install - y install EPEL release directly. If not, you can install the source code directly. Download socat source code package: http://www.dest-unreach.org/socat/download/ Compile and install decompress the downloaded software package and compile and install it in the traditional way:

./configure     #gcc required
make  
make install  

The following errors may be encountered during compilation: / sbin/sh: fipsld:command not found There are two solutions: The first is to disable FIPS and configure it with the following command:/ configure --disable-fips The second is to install fips. First go to the website http://www.openssl.org/source/ Download the OpenSSL fips installation package, and then unzip the installation:

./config
make  
make install  

After installation, you can directly install rabbitmq server.

rpm -ivh rabbitmq-server-3.8.26-1.el7.noarch.rpm

If 100% is displayed, the installation is successful.

Related commands

# Service startup
systemctl start rabbitmq-server.service
# Out of Service
systemctl stop rabbitmq-server.service
# Restart service
systemctl restart rabbitmq-server.service
# Set startup
chkconfig rabbitmq-server on

Install the web administration interface.

rabbitmq-plugins enable rabbitmq_management
systemctl restart rabbitmq-server.service

Create user

After installing and starting the service, you can access it through IP:15672, and you can access it normally. However, the following prompt message will appear:

Snipaste_2021-12-05_14-36-02

rabbitmq's default account and password are: guest,guest. The prompt here means that the guest account can only be accessed through localhost.

To solve this problem, we need to create an independent user and give it super administrator permissions.

# Create a user and set a password
rabbitmqctl add_user admin 123456
# Set role
rabbitmqctl set_user_tags admin administrator
# Set permissions
rabbitmqctl set_permissions  admin ConfP WriteP ReadP

In the demonstration of this article, the account and password created are admin and 123456 respectively.

After configuration, we can log in with the admin account. After logging in, you can see the following interface:

Related configuration

According to the above process, by default, we can access and use it normally. Since rabbitmq is a service, there must be some configuration files. In some versions, there will be a rabbit server after installation Conf.example file. But in my version, it's still a personal installation problem. There is no discovery. You need to get one from rabbitmq official. Specific address.

wget https://github.com/rabbitmq/rabbitmq-server/blob/master/deps/rabbit/docs/rabbitmq.conf.example

Put the file under the / etc/rabbitmq directory and rename it rabbitmq conf. Rabbitmq will automatically load the file every time it starts. After creation, we only need to modify a few configuration items.

# These values are provided by default
management.tcp.port = 15672
management.tcp.ip   = 0.0.0.0
# The following directory can be specified according to your needs. The default value is none
management.http_log_dir = /usr/local/rabbitmq/logs/

By default, just remove the comments in front of the file.

This article will be updated at any time. Please refer to the update progress

How to set up RabbitMQ service on Centos7

Posted by AudiS2 on Mon, 18 Apr 2022 18:11:06 +0930