centos8安裝RabbitMQ

2020-08-09 13:57:14
centos8安裝RabbitMQ
一、安裝erlang
# 新增倉庫
curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash
Detected operating system as centos/8.
# 安裝erlang
dnf install erlang

二、匯入金鑰

rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
三、在/etc/yum.repos.d目錄下新增rabbitmq.repo檔案,內容如下:

[bintray-rabbitmq-server]
name=bintray-rabbitmq-rpm
baseurl=https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.8.x/el/8/
gpgcheck=0
repo_gpgcheck=0
enabled=1

四、下載rabbitmq

wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.1/rabbitmq-server-3.8.1-1.el8.noarch.rpm
--2019-12-21 03:03:48-- https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.1/rabbitmq-server-3.8.1-1.el8.noarch.rpm

五、安裝rabbitmq
 dnf install rabbitmq-server-3.8.1-1.el8.noarch.rpm 
 
六、設定開機起動
chkconfig rabbitmq-server on

七、起動、停止命令

/sbin/service rabbitmq-server start

/sbin/service rabbitmq-server stop

八、啓動外掛
rabbitmq-plugins enable rabbitmq_management
九、使用http://ip:15672登錄,預設使用者爲guest,密碼爲guest

十、解決rabbitmq使用guest登陸報錯User can only log in via localhost
這是因爲rabbitmq從3.3.0開始禁止使用guest/guest許可權通過除localhost外的存取,解除的辦法也有,就是找到[rabbitmq安裝目錄]\ebin\rabbit.app
(一般我們yum安裝完rabbitmq後,不知道安裝到什麼地方了,其實是安裝到下面 下麪的路徑/usr/lib/rabbitmq/lib)
找到loopback_users,像我上面一樣,將「guest「刪掉,重新啓動服務就好了
---------------------------------------------------------------------
附:CentOS8 關閉防火牆,禁用防火牆

檢視狀態

systemctl status firewalld.service

開啓防火牆

systemctl start firewalld.service

關閉防火牆

systemctl stop firewalld.service

開啓防火牆

systemctl enable firewalld.service

禁用防火牆

systemctl disable firewalld.service
----------------------------------------------------------
重新啓動網絡卡
nmcli c reload
----------------------------------------------------------