在centos上使用yum安裝rabbitmq-server

rabbitmq及其依賴環境html

rabbitmq安裝以前須要安裝socat,不然直接安裝rabbitmq可能會報錯git

若是沒有找到,則先安裝epel源  yum -y install epel-releasegithub

yum install socat

rabbitMQ須要和erlang的版本互相匹配具體查看rabbitMQ和對應的erlang版本匹配web

在本文中,使用erlang-20.3.8.20-1.el7和rabbitmq-server-3.7.6-1.el7版本。安全

選擇erlang-20.3.x能夠兼容新的rabbitMQ3.7.x版本bash

安裝erlang

使用rabbitMQ的鏡像地址:https://github.com/rabbitmq/erlang-rpm服務器

將下面內容複製到/etc/yum.repos.d/rabbitmq_erlang.repo文件中curl

保存後使用yum下載安裝。post

yum install erlang-版本號url

版本號能夠經過訪問https://packagecloud.io/rabbitmq/erlang獲取到要安裝的對應版本。

# In /etc/yum.repos.d/rabbitmq_erlang.repo
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

在這裏我是用版本爲20.3.x這樣就能夠兼容兩個mq的版本

yum install erlang-20.3.8.20-1.el7

 

rabbitMQ-server下載安裝

使用腳本執行生成rabbitmq_rabbitmq-server.repo文件

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash

或者直接將下面內容複製到/etc/yum.repos.d/rabbitmq_rabbitmq-server.repo文件中

[rabbitmq_rabbitmq-server]
name=rabbitmq_rabbitmq-server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_rabbitmq-server-source]
name=rabbitmq_rabbitmq-server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

yum下載安裝

默認使用yum install rabbitmq-server是安裝最新版本的rabbitmq

yum install rabbitmq-server-3.7.6-1.el7

 

rabbitmq安裝完後,操做使用

啓動RabbitMQ服務
#service rabbitmq-server start
狀態查看
#rabbitmqctl status
啓用插件
#rabbitmq-plugins enable rabbitmq_management
重啓服務
#service rabbitmq-server restart
添加賬號:name 密碼:passwd
#rabbitmqctl add_user name passwd
賦予其administrator角色
#rabbitmqctl set_user_tags name administrator
設置權限
#rabbitmqctl set_permissions -p / name ".*" ".*" ".*"

rabbit默認的web端口號是15672

訪問http://ip:15672進入web管理頁面了

注意放通外網訪問,個人是騰訊雲服務器,須要配置安全組策略,增長外部訪問策略放通TCP:15672

參考連接:https://www.jianshu.com/p/f54dc259a9ed/

相關文章
相關標籤/搜索