RabbitMQ 3.8.7 在 centos7 上安裝
阿新 • • 發佈:2020-09-05
1、安裝 erlang
因為 RabbitMQ
是 erlang
語言開發,所以需要依賴 erlang
環境,所以在安裝 RabbitMQ
前需要先安裝 erlang
wget https://packages.erlang-solutions.com/erlang-solutions-2.0-1.noarch.rpm
rpm -Uvh erlang-solutions-2.0-1.noarch.rpm
rpm --import https://packages.erlang-solutions.com/rpm/erlang_solutions.asc
vim /etc/yum.repos.d/rabbitmq.repo
# 新增如下內容
[erlang-solutions]
name=CentOS $releasever - $basearch - Erlang Solutions
baseurl=https://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch
gpgcheck=1
gpgkey=https://packages.erlang-solutions.com/rpm/erlang_solutions.asc
enabled=1
# 安裝EPEL
#頁面地址 https://fedoraproject.org/wiki/EPELc
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# 下載安裝erlang
yum install -y erlang
2、安裝 RabbitMQ
RabbitMQ
rpm 包下載:
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.7/rabbitmq-server-3.8.7-1.el7.noarch.rpm
RabbitMQ
安裝:
# socat 相關依賴
yum install -y socat
# 安裝 rabbitmq
rpm -ivh rabbitmq-server-3.8.7-1.el7.noarch.rpm
3、開啟 RabbitMQ 管理外掛
開啟並修改 RabbitMQ
配置檔案:
vim /etc/rabbitmq/rabbitmq.conf
沒安裝 vim
可以使用 vi
vi /etc/rabbitmq/rabbitmq.conf
將 loopback_users.guest = false
這個註釋開啟,才可以在管理外掛上使用 guest
使用者。
開啟 RabbitMQ
管理外掛:
rabbitmq-plugins enable rabbitmq_management
輸入後回車執行命令,shell 上會出現如下內容:
Enabling plugins on node rabbit@VM_0_14_centos:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@VM_0_14_centos...
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
set 3 plugins.
Offline change; changes will take effect at broker restart.
啟動 RabbitMQ
:
systemctl start rabbitmq-server.service
看一下服務是否啟動:
systemctl status rabbitmq-server.service
設定 RabbitMQ
開機自啟動:
systemctl enable rabbitmq-server.service
訪問 web 管理介面(如果使用雲伺服器需要放開規則)
http://{IP}:15672/
使用 guess
賬戶登入:
Username:guess
password:guess
登入成功後就會出現這樣的頁面: