环境准备基础系统:CentOS7.6Erlang和RabbitMQ需要版本对应,参考这里,本次使用的Erlang版本如下:otp_src_22.0.tar.gz(RabbitMQ是基于Erlang语言开发的,所以必须先安装Erlang)RabbitMQ:rabbitmq-server-generic-unix-3.7.15.tar.xz1、下载并上传对应版本的软件包1.1。Erlang下载erlang官网:https://www.erlang.org/downloadsotp_src_22.0.tar.gz(1慢使用2)下载1下载21.2。RabbitMQ下载下载地址:https://github.com/rabbitmq/r...rabbitmq-server-generic-unix-3.7.15.tar.xz下载1.3。通过WinScp上传拖一个文件到服务器目录/usr/local/2。安装依赖yum-yinstallgccglibc-develmakencurses-developenssl-develxmltoperlwgetgtk2-develbinutils-devel3。Erlang安装[root@localhost/]#cd/usr/local/#unzip[root@localhostlocal]#tar-zxvfotp_src_22.0.tar.gz#createinstallationdirectory[root@localhostlocal]#mkdirerlang#switchdirectory[root@localhostlocal]#cdotp_src_22.0#配置安装路径[root@localhostotp_src_22.0]#./configure--prefix=/usr/local/erlang如果遇到如下界面,百度说不要不急,那我们继续下一步#安装[root@localhostotp_src_22.0]#makeinstall#检查是否安装完成[root@localhostotp_src_22.0]#cd/usr/local/erlang/[root@localhosterlang]#ls-l总使用量0drwxr-xr-x。2rootroot1281月21日15:40bindrwxr-xr-x。3rootroot20January2115:39lib#ConfigureErlang环境变量[root@localhosterlang]#echo'exportPATH=$PATH:/usr/local/erlang/bin'>>/etc/profile#Refreshenvironmentvariables[root@localhosterlang]#source/etc/profile#验证成功[root@localhosterlang]#cd/[root@localhost/]#erlErlang/OTP22[erts-10.4][source][64-bit][smp:1:1][ds:1:1:10][async-threads:1][hipe]EshellV10.4(abortwith^G)1>#Enterhalt()。命令退出(没看错,有点)1>1>halt().[root@localhost/]#4.RabbitMQ安装#tar.xz文件需要命令xz,没有的话先安装[root@localhost/]/]#cd/usr/local/[root@localhostlocal]#yuminstall-yxz#Unzip[root@localhostlocal]#xz-drabbitmq-server-generic-unix-3.7.15.tar.xz[root@localhostlocal]#tar-xvfrabbitmq-server-generic-unix-3.7.15.tar#文件夹重命名[root@localhostlocal]#mvrabbitmq_server-3.7.15rabbitmq#配置RabbitMQ环境变量[root@localhostlocal]#echo'exportPATH=$PATH:/usr/local/rabbitmq/sbin'>>/etc/profile#刷新环境变量[root@localhostlocal]#source/etc/profile#验证服务是否安装成功#服务启动[root@localhostlocal]#rabbitmq-server-detachedWarning:PIDfilenotwritten;-已通过分离。#Servicestatus[root@localhostlocal]#rabbitmqctlstatus#Serviceshutdown[root@localhostlocal]#rabbitmqctlstop停止和停止节点rabbit@localhost...5。安装WEB管理界面#installation[root@localhostlocal]#rabbitmq-pluginsenablerabbitmq_management#firewallreleasePorts5672and15672[root@localhostlocal]#firewall-cmd--zone=public--add-port=5672/tcp--permanentsuccess[root@localhostlocal]#firewall-cmd--zone=public--add-port=15672/tcp--permanentsuccess#查看防火墙端口是否释放[root@localhostlocal]#firewall-cmd--query-port=15672/tcpno[root@localhostlocal]#firewall-cmd--query-port=5672/tcpno#重启防火墙[root@localhostlocal]#firewall-cmd--reloadsuccess#查看防火墙端口是否正常已发布[root@localhostlocal]#firewall-cmd--query-port=5672/tcpyes[root@localhostlocal]#firewall-cmd--query-port=15672/tcpyes浏览器访问:ip:15672默认账号密码为如下图:guestguest(此账号只允许本地访问)6.RabbitMQ用户管理#查看所有用户[root@localhostlocal]#rabbitmqctllist_usersListingusers...usertagsguest[administrator]#添加用户和密码[root@localhostlocal]#rabbitmqctladd_usercharmsongo123456添加用户"charmsongo"...#Configurationpermissions[root@localhostlocal]#rabbitmqctlset_permissions-p"/"charmsongo".*"".*"".*"在vhost中为用户"charmsongo"设置权限"/"...查看charmsongo权限[root@localhostlocal]#rabbitmqctllist_user_permissionscharmsongoListingpermissionsforuser"charmsongo"...vhostconfigurewriteread/.*.*.*#Settagtoadministrator[root@localhostlocal]#rabbitmqctlset_user_tagscharmsongoadministratorSettingtagsforuser"charmsongo"to[administrator]...[root@localhostlocal]#rabbitmqctllist_usersListingusers...usertagscharmsongo[administrator]guest[administrator]#删除默认用户(为了安全)[root@localhostlocal]#rabbitmqctldelete_userguestDeletinguser"guest"...7.登录验证使用新的账号和密码登录(如如果失败,可以重启RabbitMQ服务)End...如有不妥之处,请指出,先行感谢
