关于rabbitmq:CentOS7安装RabbitMQ

46次阅读

共计 2821 个字符,预计需要花费 8 分钟才能阅读完成。

装置 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

拜访:http://127.0.0.1:15672/

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

正文完
 0