安装erlang
由于rabbitmq是基于erlang语言开发的,所以必须先安装erlang。
安装依赖
yum -y install gcc glibc-devel make ncurses-devel openssl-devel xmlto perl wget gtk2-devel binutils-devel
下载(会比较慢,请耐心等待)
wget http://erlang.org/download/otp_src_23.0.tar.gz
解压
[root@t3-yyknccs-hipcust-app01 sysadm]# tar -xf otp_src_23.0.tar.gz
[root@t3-yyknccs-hipcust-app01 sysadm]# ls
minio openresty-1.19.3.1_use.tar.gz otp_src_23.0 rabbitmq-server-3.8.11 seata-server-1.4.2.tar.gz
nohup.out openresty-usrlocal.tar.gz otp_src_23.0.tar.gz rabbitmq-server-3.8.11.tar.xz software.tar.gz
[root@t3-yyknccs-hipcust-app01 sysadm]# cd otp_src_23.0
[root@t3-yyknccs-hipcust-app01 otp_src_23.0]# ls
AUTHORS CONTRIBUTING.md Jenkinsfile.benchmark Jenkinsfile.windows make otp_versions.table README.md
bin erl-build-tool-vars.sh Jenkinsfile.daily-rebuild Jenkinsfile.wsl Makefile.in plt scripts
bootstrap erts Jenkinsfile.run-otp-tests jenkins-swarm otp_build prebuilt.files system
configure HOWTO Jenkinsfile.run-otp-tests-wsl lib otp_patch_apply proposed_updates.json TAR.include
configure.src Jenkinsfile Jenkinsfile.test-configurations LICENSE.txt OTP_VERSION README-jenkins.md xcomp
[root@t3-yyknccs-hipcust-app01 otp_src_23.0]# ./configure --prefix=/usr/local/erlang
如果遇到这个错 你就假装没看到
安装
[root@t3-yyknccs-hipcust-app01 otp_src_23.0]# make && make install
查看一下是否安装成功
ll /usr/local/erlang/bin
添加环境变量
[root@t3-yyknccs-hipcust-app01 otp_src_23.0]# echo $?
0
[root@t3-yyknccs-hipcust-app01 otp_src_23.0]# echo 'export PATH=$PATH:/usr/local/erlang/bin' >> /etc/profile
[root@t3-yyknccs-hipcust-app01 otp_src_23.0]# source /etc/profile
[root@t3-yyknccs-hipcust-app01 otp_src_23.0]# erl
install rabbitmq
下载
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.15/rabbitmq-server-generic-unix-3.8.15.tar.xz
由于是tar.xz格式的所以需要用到xz,没有的话就先安装
yum install -y xz
第一次解压
xz -d rabbitmq-server-generic-unix-3.8.15.tar.xz
第二次解压
tar -xvf rabbitmq-server-generic-unix-3.7.15.tar
移走
mv rabbitmq_server-3.7.15/ /usr/local/
mv /usr/local/rabbitmq_server-3.7.15 rabbitmq
配置环境变量
echo 'export PATH=$PATH:/usr/local/rabbitmq/sbin' >> /etc/profile
刷新环境变量
source /etc/profile
创建配置目录(本博客并未使用单独的配置文件,因此本步骤纯属多余,感谢朋友特意指正。)
mkdir /etc/rabbitmq
回到顶部
启动命令
启动:
rabbitmq-server -detached
停止:
rabbitmqctl stop
状态:
rabbitmqctl status
防火墙之类的请自行处理(5672和15672端口),反正我是从来不开防火墙。
回到顶部
WEB管理
开启web插件
rabbitmq-plugins enable rabbitmq_management
rabbitmq 使用
[root@t3-yyknccs-hipcust-app01 ~]# rabbitmqctl add_user root xxxxxx6 #增加访问用户,默认用户guest只能本地访问
Adding user "root" ...
Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more.
[root@t3-yyknccs-hipcust-app01 ~]# echo $?
0
[root@t3-yyknccs-hipcust-app01 ~]# rabbitmqctl set_user_tags root administrator # 设置角色为administrator
Setting tags for user "root" to [administrator] ...
[root@t3-yyknccs-hipcust-app01 ~]# echo $?
0
[root@t3-yyknccs-hipcust-app01 ~]# rabbitmqctl set_permissions -p "/" root "." "." ".*" # 添加权限
Setting permissions for user "root" in vhost "/" ...
[root@t3-yyknccs-hipcust-app01 ~]# echo $?
0
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。