1.前言
1.1.編寫目的
本文簡述了如何在CentOS中實現(xiàn)安裝abbitmq-server v3.7.3蹲盘。
2.安裝前的準備
2.1.安裝必備工作
- 安裝工具
# yum install -y vim wget
" 修改host
# hostname
# vim /etc/hosts
" 在host中增加主機名解析,如:
127.0.0.1 my-pc localhost
- ==【!】特別注意,一定一定要先清除原系統(tǒng)中的rabbitmq殘余>允睢玫恳!辨赐,否則安裝會出現(xiàn)各種問題。==
# find / -name 'rabbitmq' | xargs rm -rf
2.2.修改軟件源
# cd /etc/yum.repo.d/
# mv CentOS-Base.repo CentOS-Base.repo.bak
" 增加aliyun源
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
增加erlang源
# vim /etc/yum.repos.d/rabbitmq-erlang.repo
內(nèi)容如下:
[rabbitmq-erlang]
name=rabbitmq-erlang
baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7
gpgcheck=1
gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
repo_gpgcheck=0
enabled=1
2.3.下載rabbitmq-server-3.7.3
下載地址:https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.7.3
京办。
3.執(zhí)行安裝
3.1.安裝rabbitmq-server-3.7.3
# cd /path/to/Downloads
# rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
# yum install -y rabbitmq-server-3.7.3-1.el7.noarch.rpm
【!】==注意掀序,先關(guān)閉firewalld==
" 解除firewall自動啟動
# systemctl disable firewalld
" 關(guān)閉firewalld
# systemctl disable firewalld
3.2.rabbitMQ 相關(guān)命令
" 開機啟動
# systemctl enable rabbitmq-server.service
" 啟動
# systemctl start rabbitmq-server.service
" 重啟
# systemctl restart rabbitmq-server.service
" 關(guān)閉
# systemctl stop rabbitmq-server.service
3.3.開啟web管理控制
# rabbitmq-plugins enable rabbitmq_management
3.4.web控制臺
==【!】注意,默認rabbitmq的15672為localhost訪問==惭婿,要開啟遠程訪問不恭,需要做如下處理:
# vim /etc/rabbitmq/rabbitmq.conf
" 加入以下內(nèi)容
loopback_users = none
4.常見問題
4.1.RabbitMQ 3.7.4及以版本
提示:==筆者親測在CentOS 7上RabbitMQ 3.7.4叶雹,RabbitMQ 3.7.5無法安裝成功。==
4.2.cookie權(quán)限問題
報錯: [error] Error when reading /var/lib/rabbitmq/.erlang.cookie...
解決:
# chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie