Install RabbitMQ and related environment configuration under Linux

Preface

RabbitMQ is an open source message broker software (also known as message-oriented middleware) that implements the Advanced Message Queuing Protocol (AMQP). The RabbitMQ server is written in Erlang language, and clustering and failover are built on the framework of an open telecommunications platform. All major programming languages ​​have client libraries that communicate with the agent interface.

Official website  https://www.rabbitmq.com/

 

Preparation steps

erlang : OTP 19.3

rabbitmq:rabbitmq-server 3.6.12

 

erlang has been installed and can be skipped

1. Install the pre-environment

yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel

2. Create a directory

cd /opt
mkdir rabbitmq

3. Download the source code

   https://www.erlang.org/downloads/

  Method 1 Link:  https://pan.baidu.com/s/1MhrvtrcR3PKKei77j3EcvA  Password: maib 

  Put it in the directory /opt/rabbitmq

  Way two 

cd /opt/rabbitmq
wget http://erlang.org/download/otp_src_19.3.tar.gz

4. Unzip

tar -xvf otp_src_19.3.tar.gz

5. Rename

 mv otp_src_19.3 otp

6. Configure compilation

cd /opt/rabbitmq/otp
./configure --prefix=/opt/rabbitmq/otp --without-javac
make
make install

 7. Set environment variables

vi /etc/profile

  Press i in English input state to enter insert mode, add the following configuration 

export PATH=$PATH:/opt/rabbitmq/otp/bin

  Press esc to enter  : wq to  save and exit, compile /etc/profile to make the configuration effective

source /etc/profile

8. Verification

erl

If a version number appears, it means success!

 

Formal steps

1. Download the rpm package

cd /opt/rabbitmq
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.12/rabbitmq-server-3.6.12-1.el6.noarch.rpm

2. Install the extension source

yum -y install epel-release
yum -y install socat

3. Unzip the rpm package

rpm -ivh --nodeps --force rabbitmq-server-3.6.12-1.el6.noarch.rpm

4. Generate configuration file (do not change the path, copy and run)

 cp /usr/share/doc/rabbitmq-server-3.6.12/rabbitmq.config.example /etc/rabbitmq/rabbitmq.config

5. Configure environment variables

vi /etc/profile

  In English input state, press i to enter insert mode. Add the following configuration (do not change the path)

export PATH=$PATH:/usr/lib/rabbitmq/bin

  Press esc to enter  : wq to  save and exit, compile /etc/profile to make the configuration effective

source /etc/profile

6. Turn on web monitoring

rabbitmq-plugins enable rabbitmq_management

7. Add boot auto-start

chkconfig rabbitmq-server on

8. Start/stop/restart/check status

service rabbitmq-server start 
service rabbitmq-server stop 
service rabbitmq-server restart
service rabbitmq-server status

9. Add users and view after startup

ln -sf /opt/rabbitmq/otp/bin/erl /usr/bin/erl
sudo rabbitmqctl add_user admin admin
rabbitmqctl set_user_tags admin administrator
rabbitmqctl list_users

10. Log in to the rabbitmq management interface

  Set up firewall rules

  Browser input address: http://server IP address:15672/

  Username and password: admin/admin

 

 

Guess you like

Origin blog.csdn.net/javanbme/article/details/111929936
Recommended