建立文件/etc/yum.repos.d/rabbitmq-erlang.reponode
[root@jx-rabbitmq ~]# vim /etc/yum.repos.d/rabbitmq-erlang.repo
往其中添加內容linux
# In /etc/yum.repos.d/rabbitmq-erlang.repo [rabbitmq-erlang] name=rabbitmq-erlang baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7 gpgcheck=1 gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc repo_gpgcheck=0 enabled=1
保存並退出。web
[root@jx-rabbitmq ~]# yum update
[root@jx-rabbitmq ~]# yum list |grep erlang erlang.x86_64 20.3-1.el7.centos rabbitmq-erlang [root@jx-rabbitmq ~]# yum install -y erlang Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package erlang.x86_64 0:20.3-1.el7.centos will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================================================================================================== Installing: erlang x86_64 20.3-1.el7.centos rabbitmq-erlang 18 M Transaction Summary ============================================================================================================================================================================================================================================== Install 1 Package Total download size: 18 M Installed size: 31 M Downloading packages: warning: /var/cache/yum/x86_64/7/rabbitmq-erlang/packages/erlang-20.3-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 6026dfca: NOKEY======================================================- ] 2.0 MB/s | 17 MB 00:00:00 ETA Public key for erlang-20.3-1.el7.centos.x86_64.rpm is not installed erlang-20.3-1.el7.centos.x86_64.rpm | 18 MB 00:00:11 Retrieving key from https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc Importing GPG key 0x6026DFCA: Userid : "RabbitMQ Release Signing Key <info@rabbitmq.com>" Fingerprint: 0a9a f211 5f46 87bd 2980 3a20 6b73 a36e 6026 dfca From : https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : erlang-20.3-1.el7.centos.x86_64 1/1 Verifying : erlang-20.3-1.el7.centos.x86_64 1/1 Installed: erlang.x86_64 0:20.3-1.el7.centos Complete! [root@jx-rabbitmq ~]#
[root@jx-rabbitmq ~]# curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash Detected operating system as centos/7. Checking for curl... Detected curl... Downloading repository file: https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/config_file.repo?os=centos&dist=7&source=script done. Installing pygpgme to verify GPG signatures... Loaded plugins: fastestmirror rabbitmq_rabbitmq-server-source/signature | 836 B 00:00:00 rabbitmq_rabbitmq-server-source/signature | 1.0 kB 00:00:00 !!! Loading mirror speeds from cached hostfile Package pygpgme-0.3-9.el7.x86_64 already installed and latest version Nothing to do Installing yum-utils... Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Package yum-utils-1.1.31-42.el7.noarch already installed and latest version Nothing to do Generating yum cache for rabbitmq_rabbitmq-server... The repository is setup! You can now install packages. [root@jx-rabbitmq ~]# yum list |grep rabbit erlang.x86_64 20.3-1.el7.centos @rabbitmq-erlang rabbitmq-server.noarch 3.7.4-1.el7 rabbitmq_rabbitmq-server
[root@jx-rabbitmq ~]# yum install -y rabbitmq-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package rabbitmq-server.noarch 0:3.7.4-1.el7 will be installed --> Processing Dependency: socat for package: rabbitmq-server-3.7.4-1.el7.noarch --> Running transaction check ---> Package socat.x86_64 0:1.7.3.2-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================================================================================================== Installing: rabbitmq-server noarch 3.7.4-1.el7 rabbitmq_rabbitmq-server 11 M Installing for dependencies: socat x86_64 1.7.3.2-2.el7 base 290 k Transaction Summary ============================================================================================================================================================================================================================================== Install 1 Package (+1 Dependent package) Total download size: 12 M Installed size: 14 M Downloading packages: (1/2): socat-1.7.3.2-2.el7.x86_64.rpm | 290 kB 00:00:01 (2/2): rabbitmq-server-3.7.4-1.el7.noarch.rpm | 11 MB 00:00:04 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 2.5 MB/s | 12 MB 00:00:04 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : socat-1.7.3.2-2.el7.x86_64 1/2 Installing : rabbitmq-server-3.7.4-1.el7.noarch 2/2 Verifying : rabbitmq-server-3.7.4-1.el7.noarch 1/2 Verifying : socat-1.7.3.2-2.el7.x86_64 2/2 Installed: rabbitmq-server.noarch 0:3.7.4-1.el7 Dependency Installed: socat.x86_64 0:1.7.3.2-2.el7 Complete! [root@jx-rabbitmq ~]#
[root@jx-rabbitmq ~]# chkconfig rabbitmq-server on Note: Forwarding request to 'systemctl enable rabbitmq-server.service'. Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service. [root@jx-rabbitmq ~]#
[root@jx-rabbitmq ~]# rabbitmq-server start ## ## ## ## RabbitMQ 3.7.4. Copyright (C) 2007-2018 Pivotal Software, Inc. ########## Licensed under the MPL. See http://www.rabbitmq.com/ ###### ## ########## Logs: /var/log/rabbitmq/rabbit@jx-rabbitmq.log /var/log/rabbitmq/rabbit@jx-rabbitmq_upgrade.log Starting broker... completed with 0 plugins.
[root@jx-rabbitmq ~]# rabbitmqctl status Status of node rabbit@jx-rabbitmq ... [{pid,11848}, {running_applications, [{rabbit,"RabbitMQ","3.7.4"}, {mnesia,"MNESIA CXC 138 12","4.15.3"}, {rabbit_common, "Modules shared by rabbitmq-server and rabbitmq-erlang-client", "3.7.4"}, {ranch_proxy_protocol,"Ranch Proxy Protocol Transport","1.4.4"}, {ranch,"Socket acceptor pool for TCP protocols.","1.4.0"}, {ssl,"Erlang/OTP SSL application","8.2.4"}, {public_key,"Public key infrastructure","1.5.2"}, {crypto,"CRYPTO","4.2.1"}, {asn1,"The Erlang ASN1 compiler version 5.0.5","5.0.5"}, {recon,"Diagnostic tools for production use","2.3.2"}, {inets,"INETS CXC 138 49","6.5"}, {os_mon,"CPO CXC 138 46","2.4.4"}, {xmerl,"XML parser","1.3.16"}, {jsx,"a streaming, evented json parsing toolkit","2.8.2"}, {lager,"Erlang logging framework","3.5.1"}, {goldrush,"Erlang event stream processor","0.1.9"}, {compiler,"ERTS CXC 138 10","7.1.5"}, {syntax_tools,"Syntax tools","2.1.4"}, {sasl,"SASL CXC 138 11","3.1.1"}, {stdlib,"ERTS CXC 138 10","3.4.4"}, {kernel,"ERTS CXC 138 10","5.4.3"}]}, {os,{unix,linux}}, {erlang_version, "Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:128] [hipe] [kernel-poll:true]\n"}, {memory, [{connection_readers,0}, {connection_writers,0}, {connection_channels,0}, {connection_other,0}, {queue_procs,0}, {queue_slave_procs,0}, {plugins,5864}, {other_proc,28602808}, {metrics,184824}, {mgmt_db,0}, {mnesia,73008}, {other_ets,1851848}, {binary,142520}, {msg_index,29104}, {code,24948783}, {atom,1041593}, {other_system,12941888}, {allocated_unused,21833952}, {reserved_unallocated,0}, {strategy,rss}, {total,[{erlang,69822240},{rss,83406848},{allocated,91656192}]}]}, {alarms,[]}, {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]}, {vm_memory_calculation_strategy,rss}, {vm_memory_high_watermark,0.4}, {vm_memory_limit,3273926246}, {disk_free_limit,50000000}, {disk_free,52195872768}, {file_descriptors, [{total_limit,924},{total_used,2},{sockets_limit,829},{sockets_used,0}]}, {processes,[{limit,1048576},{used,206}]}, {run_queue,0}, {uptime,144}, {kernel,{net_ticktime,60}}] [root@jx-rabbitmq ~]#
#3 配置json
[root@jx-rabbitmq ~]# firewall-cmd --zone=public --permanent --add-port=4369/tcp success [root@jx-rabbitmq ~]# firewall-cmd --zone=public --permanent --add-port=25672/tcp success [root@jx-rabbitmq ~]# firewall-cmd --zone=public --permanent --add-port=5671-5672/tcp success [root@jx-rabbitmq ~]# firewall-cmd --zone=public --permanent --add-port=15672/tcp success [root@jx-rabbitmq ~]# firewall-cmd --zone=public --permanent --add-port=61613-61614/tcp success [root@jx-rabbitmq ~]# firewall-cmd --zone=public --permanent --add-port=1883/tcp success [root@jx-rabbitmq ~]# firewall-cmd --zone=public --permanent --add-port=8883/tcp success [root@jx-rabbitmq ~]# firewall-cmd --reload success [root@jx-rabbitmq ~]#
若是你啓用了SELinux,須要運行如下命令來容許RabbitMQ服務。vim
[root@jx-rabbitmq ~]# setsebool -P nis_enabled 1
經過運行如下命令將RabbitMQ文件的全部權提供給RabbitMQ用戶。centos
[root@jx-rabbitmq ~]# chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/
[root@jx-rabbitmq ~]# rabbitmq-plugins enable rabbitmq_management The following plugins have been configured: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch Applying plugin configuration to rabbit@jx-rabbitmq... The following plugins have been enabled: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch started 3 plugins. [root@jx-rabbitmq ~]#
[root@jx-rabbitmq ~]# rabbitmqctl add_user admin admin Adding user "admin" ... [root@jx-rabbitmq ~]# rabbitmqctl set_user_tags admin administrator Setting tags for user "admin" to [administrator] ... [root@jx-rabbitmq ~]# rabbitmqctl set_permissions -p / admin ".*" ".*" ".*" Setting permissions for user "admin" in vhost "/" ... [root@jx-rabbitmq ~]#
在瀏覽器中輸入以下地址便可登陸rabbitmq管理控制檯系統:瀏覽器
http://rabbitmq-server:15672/
好比我這裏是:緩存
http://192.168.100.148:15672/
系統有一個默認帳號用戶名是guest,密碼也是guest,可是這個帳號只能在rabbitmq-server所在主機上的瀏覽器中登陸,在其餘主機登陸,能夠用上面建立的帳號登陸,即用戶名admin,密碼是admin。bash