一、安装erlang
通过EPEL源安装erlang
1.安装epel源
yum -y install epel-release
2.安装erlang
yum install erlang
3.安装rabbitmq
在https://www.rabbitmq.com/install-rpm.html 下载rabbitmq-server-3.6.6-1.el7.noarch.rpm
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm
并安装
rpm -ivh rabbitmq-server-3.6.6-1.el7.noarch.rpm
系统提示缺少socat依赖,遂安装socat:
yum install -y socat
再次安装rabbitmq:
rpm -ivh rabbitmq-server-3.6.6-1.el7.noarch.rpm
二、创建用户
1.创建用户rabbitmq
Tip:用户名随意
rabbitmqctl add_user rabbitmq rabbitmq # 前面是账户名,后面是密码名
错误提示:Error: unable to connect to node rabbit@mysql57: nodedown,重启rabbitmq后解决!
systemctl restart rabbitmq-server
2.添加用户至管理组
rabbitmqctl set_user_tags rabbitmq administrator
3. 查看用户
rabbitmqctl list_users
三、启用管理插件
rabbitmq-plugins enable rabbitmq_management
四、访问web管理界面
1. 开启rabbitmq
systemctl start rabbitmq-server
http://localhost:15672/ #TIP: 如果不行,请看第五步
五、允许端口通过防火墙
#允许5672通信端口 firewall-cmd --zone=public --add-port=5672/tcp --permanent #允许15672WEB控制端口 firewall-cmd --zone=public --add-port=15672/tcp --permanent #重载防火墙 firewall-cmd --reload
如果麻烦,所以直接关闭了防火墙:
systemctl stop firewalld.service # 关闭防火墙 systemctl disable firewalld.service #禁止防火墙开机启动
六、添加rabbitmq开机启动
systemctl enable rabbitmq-server
七、hello word测试
请百度
八、一键安装脚本
保存为rabbitmq.sh,赋权限并执行即可!
yum -y install epel-release wget curl yum -y install erlang yum -y install socat wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm rpm -ivh rabbitmq-server-3.6.6-1.el7.noarch.rpm systemctl restart rabbitmq-server rabbitmqctl add_user rabbitmq rabbitmq rabbitmqctl set_user_tags rabbitmq administrator rabbitmq-plugins enable rabbitmq_management echo "-----------------------------------------" echo "Rabbitmq has been installed successfully!" echo "You can access rabbitmq by:" echo "Username:rabbitmq" echo "Password:rabbitmq" echo "http://Localhost:15672"
参考链接
https://www.rabbitmq.com/download.html
https://www.rabbitmq.com/install-rpm.html
http://blog.csdn.net/zheng911209/article/details/49945677
http://blog.csdn.net/lmj623565791/article/details/37607165