1.安装rabbitmq
前言
本文介绍如何安装rabbitmq,安装版本为写该文章时的稳定最新版。
安装步骤
安装erlang
CentOS 7中安装Erlang 20.x,新建文件
/etc/yum.repos.d/rabbitmq-erlang.repo
:
# In /etc/yum.repos.d/rabbitmq-erlang.repo[rabbitmq-erlang] name=rabbitmq-erlang baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7gpgcheck=1gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.ascrepo_gpgcheck=0enabled=1
CentOS 6中安装Erlang 20.x ,新建文件
/etc/yum.repos.d/rabbitmq-erlang.repo
:
# In /etc/yum.repos.d/rabbitmq-erlang.repo[rabbitmq-erlang] name=rabbitmq-erlang baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/6gpgcheck=1gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.ascrepo_gpgcheck=0enabled=1
安装erlang,并验证是否安装成功
yum install erlang erl # 验证是否安装成功
注: 参考https://github.com/rabbitmq/erlang-rpm
安装rabbitmq-server
下载rabbitmq-server(如果没安装wget可以通过
yum install -y wget
安装该软件)
wget https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.6/rabbitmq-server-3.7.6-1.el7.noarch.rpm
安装并启动
yum -y install socatrpm -ivh rabbitmq-server-3.7.6-1.el7.noarch.rpm service rabbitmq-server start # centos 6执行该命令systemctl start rabbitmq-server.service # centos 7执行该命令
执行开机启动
chkconfig rabbitmq-server on # centos 6执行该命令systemctl enable rabbitmq-server.service # centos 7执行该命令
编辑配置文件允许guest用户登录(注意后面逗号)
cd /etc/rabbitmq/ cp /usr/share/doc/rabbitmq-server-3.7.6/rabbitmq.config.example /etc/rabbitmq/ mv rabbitmq.config.example rabbitmq.config
开启web页面管理工具
[root@bogon rabbitmq]# rabbitmq-plugins enable rabbitmq_management The following plugins have been configured: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch Applying plugin configuration to rabbit@bogon... The following plugins have been enabled: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch started 3 plugins.
重启rabbitmq
service rabbitmq-server restart # centos 6执行该命令systemctl restart rabbitmq-server.service # centos 7执行该命令
开启防火墙
iptables -I INPUT -p tcp --dport 15675 -j ACCEPT iptables -I INPUT -p tcp --dport 5672 -j ACCEPT service iptables
firewall-cmd --zone=public --add-port=15672/tcp --permanent firewall-cmd --zone=public --add-port=5672/tcp --permanent firewall-cmd --reload
centos 7
centos 6
网页访问,验证mq安装成功
http://192.168.1.249:15672
name: guest
name: guest
补充说明
centos 6 命令
service rabbitmq-server start
service rabbitmq-server stop
service rabbitmq-server restartcentos 7 命令
systemctl start rabbitmq-server.service
systemctl stop rabbitmq-server.service
systemctl restart rabbitmq-server.service
- 点赞
- 收藏
- 关注作者
评论(0)