How to Install RabbitMQ on CentOS 7

RabbitMQ is a widely used open-source message broker written in the Erlang programming language. As a message-oriented middleware, RabbitMQ can be used to implement the Advanced Message Queuing Protocol (AMQP) on all modern operating systems.

This article explains how to install RabbitMQ on a Vultr CentOS 7 server instance.

Prerequisites

Before getting started, you need to:

  • Deploy a brand new Vultr CentOS 7 server instance.
  • Log into the server as a non-root user with sudo privileges. You can learn about how to create such a sudo user in this Vultr article.

Step 1: Update the system

Use the following commands to update your CentOS 7 system to the latest stable status:

sudo yum install epel-release
sudo yum update
sudo reboot

Step 2: Install Erlang

Since RabbitMQ is written in Erlang, you need to install Erlang before you can use RabbitMQ:

cd ~
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
sudo yum install erlang

Verify your installation of Erlang:

erl

You will be brought into the Erlang shell which resembles:

Erlang/OTP 18 [erts-7.3] [source-d2a6d81] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
1>

Press Ctrl+C twice to quit the Erlang shell.

Step 3: Install RabbitMQ

Use the following commands to install the latest version of RabbitMQ which is 3.6.1 at the time of writing:

cd ~
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-3.6.1-1.noarch.rpm
sudo rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo yum install rabbitmq-server-3.6.1-1.noarch.rpm

Step 4: Modify firewall rules

In order to access the RabbitMQ remote management console, you need to allow inbound TCP traffic on ports 4369, 25672, 5671, 5672, 15672, 61613, 61614, 1883, and 8883.

sudo firewall-cmd --zone=public --permanent --add-port=4369/tcp --add-port=25672/tcp --add-port=5671-5672/tcp --add-port=15672/tcp  --add-port=61613-61614/tcp --add-port=1883/tcp --add-port=8883/tcp
sudo firewall-cmd --reload

Start the RabbitMQ server and enable it to start on system boot:

sudo systemctl start rabbitmq-server.service
sudo systemctl enable rabbitmq-server.service

You can check the status of RabbitMQ with:

sudo rabbitmqctl status

Step 5: Enable and use the RabbitMQ management console

Enable the RabbitMQ management console so that you can monitor the RabbitMQ server processes from a web browser:

sudo rabbitmq-plugins enable rabbitmq_management
sudo chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/

Next, you need to setup an administrator user account for accessing the RabbitMQ server management console. In the following commands, "mqadmin" is the administrator's username, "mqadminpassword" is the password. Remember to replace them with your own ones.

sudo rabbitmqctl add_user mqadmin mqadminpassword
sudo rabbitmqctl set_user_tags mqadmin administrator
sudo rabbitmqctl set_permissions -p / mqadmin ".*" ".*" ".*"

Now, visit the following URL:

http://[your-vultr-server-IP]:15672/

Log in with the credentials you had specified earlier. You will be greeted with the RabbitMQ remote management console, where you can learn more about RabbitMQ. Enjoy!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值