通过 yum 在 CentOS 7 环境下安装 RabbitMQ Server 3.8。
配置yum源 这次安装使用官方推荐的,基于 PackageCloud 的 Yum 仓库安装。
进入官网 https://packagecloud.io/rabbitmq/rabbitmq-server/install#bash-rpm
。
我们可以看到 quick install 的快速安装命令。
1 2 3 4 5 6 7 8 9 10 11 $ curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash ... Complete! Generating yum cache for rabbitmq_rabbitmq-server... Importing GPG key 0x4D206F89: Userid : "https://packagecloud.io/rabbitmq/rabbitmq-server (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>" Fingerprint: 8c69 5b02 19af deb0 4a05 8ed8 f4e7 8920 4d20 6f89 From : https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey Generating yum cache for rabbitmq_rabbitmq-server-source... The repository is setup! You can now install packages.
脚本执行后,会安装一些最基本的底层依赖,比如 yum-utils.noarch
。同时还会生成 /etc/yum.repos.d/rabbitmq_rabbitmq-server.repo
文件。
安装 Erlang 依赖。进入页面https://packagecloud.io/rabbitmq/erlang/install#bash-rpm
。
1 2 3 4 5 $ curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash ... Generating yum cache for rabbitmq_erlang-source... The repository is setup! You can now install packages.
安装 安装Erlang 首先安装Erlang语言依赖。
1 $ sudo yum install erlang
安装RabbitMQ 1 $ sudo yum install rabbitmq-server
设置开机自动启动
1 chkconfig rabbitmq-server on
启动/关闭 RabbitMQ 服务
1 2 3 systemctl start rabbitmq-server systemctl stop rabbitmq-server
安装插件 查看插件列表
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 $ sudo rabbitmq-plugins list Listing plugins with pattern ".*" ... Configured: E = explicitly enabled; e = implicitly enabled | Status: * = running on rabbit@localhost |/ [ ] rabbitmq_amqp1_0 3.8.3 [ ] rabbitmq_auth_backend_cache 3.8.3 [ ] rabbitmq_auth_backend_http 3.8.3 [ ] rabbitmq_auth_backend_ldap 3.8.3 [ ] rabbitmq_auth_backend_oauth2 3.8.3 [ ] rabbitmq_auth_mechanism_ssl 3.8.3 [ ] rabbitmq_consistent_hash_exchange 3.8.3 [ ] rabbitmq_event_exchange 3.8.3 [ ] rabbitmq_federation 3.8.3 [ ] rabbitmq_federation_management 3.8.3 [ ] rabbitmq_jms_topic_exchange 3.8.3 [ ] rabbitmq_management 3.8.3 [ ] rabbitmq_management_agent 3.8.3 [ ] rabbitmq_mqtt 3.8.3 [ ] rabbitmq_peer_discovery_aws 3.8.3 [ ] rabbitmq_peer_discovery_common 3.8.3 [ ] rabbitmq_peer_discovery_consul 3.8.3 [ ] rabbitmq_peer_discovery_etcd 3.8.3 [ ] rabbitmq_peer_discovery_k8s 3.8.3 [ ] rabbitmq_prometheus 3.8.3 [ ] rabbitmq_random_exchange 3.8.3 [ ] rabbitmq_recent_history_exchange 3.8.3 [ ] rabbitmq_sharding 3.8.3 [ ] rabbitmq_shovel 3.8.3 [ ] rabbitmq_shovel_management 3.8.3 [ ] rabbitmq_stomp 3.8.3 [ ] rabbitmq_top 3.8.3 [ ] rabbitmq_tracing 3.8.3 [ ] rabbitmq_trust_store 3.8.3 [ ] rabbitmq_web_dispatch 3.8.3 [ ] rabbitmq_web_mqtt 3.8.3 [ ] rabbitmq_web_mqtt_examples 3.8.3 [ ] rabbitmq_web_stomp 3.8.3 [ ] rabbitmq_web_stomp_examples 3.8.3
启动管理平台插件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ sudo rabbitmq-plugins enable rabbitmq_management Enabling plugins on node rabbit@localhost: rabbitmq_management The following plugins have been configured: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch Applying plugin configuration to rabbit@localhost... The following plugins have been enabled: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch started 3 plugins.
查看端口占用情况。
1 2 3 4 $ ss -tunlp | grep 5672 tcp LISTEN 0 128 *:15672 *:* tcp LISTEN 0 128 *:25672 *:* tcp LISTEN 0 128 [::]:5672 [::]:*
5672 是 RabbitMQ Server 端口,25672 是集群端口,15672 是web管理平台端口。
配置 设置登录用户,编译文件:
1 $ sudo vi /usr/lib/rabbitmq/lib/rabbitmq_server-3.8.3/ebin/rabbit.app
把如下内容:
{loopback_users, [<<"guest">>]}
改为 {loopback_users, ["guest"]}
。
重启。
访问页面:http://<server-ip>:15672/
,通过用户名 guest
和密码 guest
就可以成功登录了。