Rabbitmq installation configuration (CentOS)

Time:2022-1-15

1. Download and install

To install rabbitmq server, you need to install Python and Erlang first
The CentOS system comes with Python. If the version is not too low, you can skip the installation
Download and install Erlang,Download from the official website

#Install Erlang source
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
#Install Erlang
yum install -y erlang

Download and install rabbitmq,Download from the official website

#Download rabbitmq server
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.0/rabbitmq-server-3.6.0-1.noarch.rpm
#Installation
rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
yum install rabbitmq-server-3.6.0-1.noarch.rpm
#Installation成服务
chkconfig rabbitmq-server on
#Open the management plug-in
rabbitmq-plugins enable rabbitmq-management

2. Configuration

2.1 configuring hosts
# hosts
echo "127.0.0.1    localhost    your_hostname" >> /etc/hosts

For remote, open ports 5672 and 15672 (for management)

2.2 add administrator user
#Add user admin, password [email protected]
rabbitmqctl add_user admin [email protected]
#Assign administrator role
rabbitmqctl set_user_tags admin administrator
2.3 adding virtual host
#Add Vhost
rabbitmqctl add_vhost /hostname
#Set user permissions for Vhost
rabbitmqctl set_permissions -p /hostname username ".*" ".*" ".*"