1.依赖环境的安装-如果需要用编译安装erlang语言环境,需要安装C++编译。
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC unixODBC-devel httpd python-simplejson
2.erlang语言环境的安装(rabbitMq是用erlang分布式语言开发的)
http://erlang.org/download/otp_src_19.2.tar.gz
[root@localhost ~]# mkdir /usr/local/erlang
[root@localhost ~]# cd otp_src_19.3
[root@localhost otp_src_19.3]# ./configure --prefix=/usr/local/erlang --without-javac
[root@localhost otp_src_19.3]# make && make install
3.编译&安装完成以后配置Erlang环境变量:
[root@localhost otp_src_19.3]# vim /etc/profile
#追加环境变量到文件末尾
ERL_HOME=/usr/local/erlang
PATH=$ERL_HOME/bin:$PATH
export ERL_HOME PATH
[root@localhost otp_src_19.3]# source /etc/profile
4.安装RabbitMQ:
http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-generic-unix-3.6.1.tar.xz //下载RabbitMQ安装包
[root@localhost ~]#xz -d rabbitmq-server-generic-unix-3.6.1.tar.xz
[root@localhost ~]#tar -xvf rabbitmq-server-generic-unix-3.6.1.tar
5.配置rabbitmq环境变量:
vi /etc/profile
#set rabbitmq environment
export PATH=$PATH:/usr/local/rabbitmq/sbin
source /etc/profile
相关命令:
启动服务:rabbitmq-server -detached【 /usr/local/rabbitmq/sbin/rabbitmq-server -detached 】
查看状态:rabbitmqctl status【 /usr/local/rabbitmq/sbin/rabbitmqctl status 】
关闭服务:rabbitmqctl stop【 /usr/local/rabbitmq/sbin/rabbitmqctl stop 】
列出角色:rabbitmqctl list_users
6.配置网页插件:
mkdir /etc/rabbitmq
启用插件:
rabbitmq-plugins enable rabbitmq_management
7.配置防火墙:
配置linux 端口 15672 网页管理 5672 AMQP端口:
firewall-cmd --permanent --add-port=15672/tcp
firewall-cmd --permanent --add-port=5672/tcp
systemctl restart firewalld.service
firewall-cmd --zone=public --add-port=80/tcp --permanent
返回success为成功
命令含义:
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效
重启防火墙:
systemctl restart firewalld.service
关闭防火墙:
systemctl stop firewalld.service
8.配置访问账号密码和权限:
rabbitmqctl add_user test test //添加用户,后面两个参数分别是用户名和密码,我这都用superrd了。
rabbitmqctl set_permissions -p / test ".*" ".*" ".*" //添加权限
rabbitmqctl set_user_tags test administrator //修改用户角色
登录:http://192.168.197.160:15672 登录:
https://www.cnblogs.com/hlhdidi/p/6535677.html
https://www.linuxidc.com/Linux/2018-01/150600.htm
https://www.linuxidc.com/Linux/2018-01/150600.htm
https://blog.csdn.net/yin767833376/article/details/81223491
http://www.rabbitmq.com/networking.html
http://www.rabbitmq.com/management.html