{"id":81335,"date":"2023-10-22T02:08:05","date_gmt":"2023-10-21T18:08:05","guid":{"rendered":"http:\/\/gulass.cn\/?p=81335"},"modified":"2023-10-22T02:08:05","modified_gmt":"2023-10-21T18:08:05","slug":"install-rabbitmq-on-centos-7","status":"publish","type":"post","link":"https:\/\/gulass.cn\/install-rabbitmq-on-centos-7.html","title":{"rendered":"\u5728CentOS 7\u4e0a\u5b89\u88c5RabbitMQ\u670d\u52a1\u5668"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nRabbitMQ\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u5f00\u6e90\u4f01\u4e1a\u6d88\u606f\u4ee3\u7406\u8f6f\u4ef6\u3002 \u5b83\u662f\u7528Erlang\u7f16\u5199\u7684\uff0c\u5e76\u5b9e\u73b0\u4e86\u9ad8\u7ea7\u6d88\u606f\u961f\u5217\u534f\u8bae\uff08AMQP\uff09\u3002 \u5b83\u63d0\u4f9b\u6240\u6709\u4e3b\u8981\u7f16\u7a0b\u8bed\u8a00\u7684\u5ba2\u6237\u7aef\u5e93\u3002 \u5b83\u652f\u6301\u591a\u79cd\u6d88\u606f\u4f20\u9012\u534f\u8bae\uff0c\u6d88\u606f\u961f\u5217\uff0c\u4f20\u9001\u786e\u8ba4\uff0c\u7075\u6d3b\u7684\u8def\u7531\u5230\u961f\u5217\uff0c\u591a\u79cd\u4ea4\u6362\u7c7b\u578b\u3002 \u5b83\u8fd8\u63d0\u4f9b\u6613\u4e8e\u4f7f\u7528\u7684HTTP-API\uff0c\u547d\u4ee4\u884c\u5de5\u5177\u548c\u7528\u4e8e\u7ba1\u7406RabbitMQ\u7684Web UI\uff1b\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5728CentOS 7\u670d\u52a1\u5668\u4e0a\u5b89\u88c5RabbitMQ\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u6761\u4ef6<\/strong><\/div>\n
    \n
  • \u6700\u5c0fCentOS 7\u670d\u52a1\u5668<\/li>\n
  • \u6839\u6743\u9650 \u672c\u6307\u5357\u4ee5root\u7528\u6237\u8eab\u4efd\u7f16\u5199\uff0c\u5982\u679c\u4ee5sudo\u7528\u6237\u8eab\u4efd\u767b\u5f55\uff0c\u8bf7\u8fd0\u884csudo -i \u3002<\/li>\n<\/ul>\n
    \u66f4\u65b0\u57fa\u672c\u7cfb\u7edf<\/strong><\/div>\n

    \u5728\u5b89\u88c5\u4efb\u4f55\u8f6f\u4ef6\u5305\u4e4b\u524d\uff0c\u5efa\u8bae\u60a8\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0\u8f6f\u4ef6\u5305\u548c\u5b58\u50a8\u5e93\u3002<\/p>\n

    yum -y update<\/pre>\n

    \u66f4\u65b0\u7cfb\u7edf\u540e\uff0c\u8fdb\u4e00\u6b65\u5b89\u88c5Erlang\u3002<\/p>\n

    \u5b89\u88c5Erlang<\/strong><\/div>\n

    RabbitMQ\u662f\u7528Erlang\u8bed\u8a00\u7f16\u5199\u7684\uff0c\u5728\u672c\u6559\u7a0b\u4e2d\u6211\u4eec\u5c06\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Erlang\u5230\u670d\u52a1\u5668\u4e2d\u3002 Erlang\u5728\u9ed8\u8ba4\u7684YUM\u5b58\u50a8\u5e93\u4e2d\u4e0d\u53ef\u7528\uff0c\u56e0\u6b64\u60a8\u5c06\u9700\u8981\u5b89\u88c5EPEL\u5b58\u50a8\u5e93\u3002 \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u76f8\u540c\u3002<\/p>\n

    yum -y install epel-release\r\n\r\nyum -y update<\/pre>\n

    \u73b0\u5728\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Erlang\u3002<\/p>\n

    yum -y install erlang socat<\/pre>\n

    \u60a8\u73b0\u5728\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5Erlang\u7248\u672c\u3002<\/p>\n

    erl -version<\/p>\n

    \u60a8\u5c06\u5f97\u5230\u4ee5\u4e0b\u8f93\u51fa\u3002<\/p>\n

    [root@liptan-pc ~]# erl -version\r\nErlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 5.10.4<\/pre>\n

    \u8981\u5207\u6362\u5230Erlang shell\uff0c\u53ef\u4ee5\u952e\u5165\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n

    erl<\/pre>\n

    shell\u5c06\u66f4\u6539\uff0c\u60a8\u5c06\u5f97\u5230\u4ee5\u4e0b\u8f93\u51fa\u3002<\/p>\n

    Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]\r\n\r\nEshell V5.10.4  (abort with ^G)\r\n1>\r\n<\/pre>\n

    \u60a8\u53ef\u4ee5\u901a\u8fc7\u6309ctrl + C\u4e24\u6b21\u9000\u51fashell\u3002 Erlang\u73b0\u5728\u5b89\u88c5\u5728\u7cfb\u7edf\u4e0a\uff0c\u73b0\u5728\u53ef\u4ee5\u7ee7\u7eed\u5b89\u88c5RabbitMQ\u3002<\/p>\n

    \u5b89\u88c5RabbitMQ<\/strong><\/div>\n

    RabbitMQ\u4e3a\u9884\u7f16\u8bd1\u5e76\u53ef\u4ee5\u76f4\u63a5\u5b89\u88c5\u7684\u4f01\u4e1aLinux\u7cfb\u7edf\u63d0\u4f9bRPM\u8f6f\u4ef6\u5305\u3002 \u552f\u4e00\u9700\u8981\u7684\u4f9d\u8d56\u662f\u5c06Erlang\u5b89\u88c5\u5230\u7cfb\u7edf\u4e2d\u3002 \u6211\u4eec\u5df2\u7ecf\u5b89\u88c5\u4e86Erlang\uff0c\u6211\u4eec\u53ef\u4ee5\u8fdb\u4e00\u6b65\u4e0b\u8f7dRabbitMQ\u3002 \u901a\u8fc7\u8fd0\u884c\u4e0b\u8f7dErlang RPM\u8f6f\u4ef6\u5305\u3002<\/p>\n

    wget https:\/\/www.rabbitmq.com\/releases\/rabbitmq-server\/v3.6.10\/rabbitmq-server-3.6.10-1.el7.noarch.rpm<\/pre>\n

    \u5982\u679c\u4f60\u6ca1\u6709\u5b89\u88c5wget \uff0c\u53ef\u4ee5\u8fd0\u884cyum -y install wget \u3002 \u60a8\u53ef\u4ee5\u968f\u65f6\u627e\u5230\u6700\u65b0\u7248\u672c\u7684RabbitMQ\u4e0b\u8f7d\u9875\u9762\u7684\u94fe\u63a5\u3002<\/p>\n

    \u901a\u8fc7\u8fd0\u884c\u5bfc\u5165GPG\u5bc6\u94a5\uff1a<\/p>\n

    rpm \u2013import https:\/\/www.rabbitmq.com\/rabbitmq-release-signing-key.asc<\/pre>\n

    \u8fd0\u884cRPM\u5b89\u88c5RPM\u5305\uff1a<\/p>\n

    rpm -Uvh rabbitmq-server-3.6.10-1.el7.noarch.rpm<\/pre>\n

    RabbitMQ\u73b0\u5df2\u5b89\u88c5\u5728\u60a8\u7684\u7cfb\u7edf\u4e0a\u3002<\/p>\n

    \u5f00\u59cbRabbitMQ<\/strong><\/div>\n

    \u60a8\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8RabbitMQ\u670d\u52a1\u5668\u8fdb\u7a0b\u3002<\/p>\n

    systemctl start rabbitmq-server<\/pre>\n

    \u8981\u5728\u5f15\u5bfc\u65f6\u81ea\u52a8\u542f\u52a8RabbitMQ\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n

    systemctl enable rabbitmq-server<\/pre>\n

    \u8981\u68c0\u67e5RabbitMQ\u670d\u52a1\u5668\u7684\u72b6\u6001\uff0c\u8bf7\u8fd0\u884c\uff1a<\/p>\n

    systemctl status rabbitmq-server<\/pre>\n

    \u5982\u679c\u542f\u52a8\u6210\u529f\uff0c\u60a8\u5e94\u8be5\u5f97\u5230\u4ee5\u4e0b\u8f93\u51fa\u3002<\/p>\n

    ? rabbitmq-server.service - RabbitMQ broker\r\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/rabbitmq-server.service; enabled; vendor preset: disabled)\r\n   Active: active (running) since Sat 2017-07-15 18:59:14 UTC; 3min 22s ago\r\n Main PID: 29006 (beam.smp)\r\n   Status: \"Initialized\"\r\n   CGroup: \/system.slice\/rabbitmq-server.service\r\n           ??29006 \/usr\/lib64\/erlang\/erts-9.0\/bin\/beam.smp -W w -A 64 -P 1048576 -t 5000000 -stbt db -zdbbl 32000 -K tr...\r\n           ??29149 \/usr\/lib64\/erlang\/erts-9.0\/bin\/epmd -daemon\r\n           ??29283 erl_child_setup 1024\r\n           ??29303 inet_gethost 4\r\n           ??29304 inet_gethost 4\r\n\r\nJul 15 18:59:13 centos rabbitmq-server[29006]: Starting broker...\r\nJul 15 18:59:14 centos rabbitmq-server[29006]: systemd unit for activation check: \"rabbitmq-server.service\"\r\nJul 15 18:59:14 centos systemd[1]: Started RabbitMQ broker.\r\nJul 15 18:59:14 centos rabbitmq-server[29006]: completed with 0 plugins.\r\n<\/pre>\n
    \u4fee\u6539\u9632\u706b\u5899\u548cSELinux\u89c4\u5219<\/strong><\/div>\n

    \u5982\u679c\u60a8\u5df2\u5b89\u88c5\u5e76\u8fd0\u884c\u9632\u706b\u5899 \uff0c\u5219\u5fc5\u987b\u901a\u8fc7\u9632\u706b\u5899\u5141\u8bb8\u7aef\u53e38161\u3002 \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u76f8\u540c\u3002<\/p>\n

    firewall-cmd \u2013zone=public \u2013permanent \u2013add-port=4369\/tcp\r\nfirewall-cmd \u2013zone=public \u2013permanent \u2013add-port=25672\/tcp\r\nfirewall-cmd \u2013zone=public \u2013permanent \u2013add-port=5671-5672\/tcp\r\nfirewall-cmd \u2013zone=public \u2013permanent \u2013add-port=15672\/tcp\r\nfirewall-cmd \u2013zone=public \u2013permanent \u2013add-port=61613-61614\/tcp\r\nfirewall-cmd \u2013zone=public \u2013permanent \u2013add-port=1883\/tcp\r\nfirewall-cmd \u2013zone=public \u2013permanent \u2013add-port=8883\/tcp\r\n<\/pre>\n
    firewall-cmd \u2013reload\r\n<\/pre>\n

    \u5982\u679c\u60a8\u542f\u7528SELinux\uff0c\u5219\u5fc5\u987b\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u5141\u8bb8RabbitMQ\u670d\u52a1\u3002<\/p>\n

    setsebool -P nis_enabled 1<\/pre>\n
    \u8bbf\u95eeWeb\u63a7\u5236\u53f0<\/strong><\/div>\n

    \u542f\u52a8RabbitMQ Web\u7ba1\u7406\u63a7\u5236\u53f0\uff0c\u65b9\u6cd5\u662f\u8fd0\u884c\uff1a<\/p>\n

    rabbitmq-plugins enable rabbitmq_management<\/pre>\n

    \u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5c06RabbitMQ\u6587\u4ef6\u7684\u6240\u6709\u6743\u63d0\u4f9b\u7ed9RabbitMQ\u7528\u6237\uff1a<\/p>\n

    chown -R rabbitmq:rabbitmq \/var\/lib\/rabbitmq\/<\/pre>\n

    \u73b0\u5728\uff0c\u60a8\u5c06\u9700\u8981\u4e3aRabbitMQ Web\u7ba1\u7406\u63a7\u5236\u53f0\u521b\u5efa\u7ba1\u7406\u7528\u6237\u3002 \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u76f8\u540c\u3002<\/p>\n

    rabbitmqctl add_user admin StrongPassword\r\nrabbitmqctl set_user_tags admin administrator\r\nrabbitmqctl set_permissions -p \/ admin \u201c.*\u201d \u201c.*\u201d \u201c.*\u201d\r\n<\/pre>\n

    \u5c06\u7ba1\u7406\u5458\u66f4\u6539\u4e3a\u7ba1\u7406\u5458\u7528\u6237\u7684\u9996\u9009\u7528\u6237\u540d\u3002 \u786e\u4fdd\u5c06StrongPassword\u66f4\u6539\u4e3a\u975e\u5e38\u5f3a\u5927\u7684\u5bc6\u7801\u3002<\/p>\n

    \u8981\u8bbf\u95eeRabbitMQ\u7684\u7ba1\u7406\u9762\u677f\uff0c\u8bf7\u4f7f\u7528\u60a8\u6700\u559c\u7231\u7684Web\u6d4f\u89c8\u5668\u5e76\u6253\u5f00\u4ee5\u4e0bURL\u3002<\/p>\n

    http:\/\/Your_Server_IP:15672\/<\/pre>\n

    \u60a8\u5c06\u770b\u5230\u4ee5\u4e0b\u767b\u5f55\u9875\u9762\u3002<\/p>\n

    \"\"<\/p>\n

    \u767b\u5f55\u540e\uff0c\u60a8\u5c06\u770b\u5230\u7ba1\u7406\u4fe1\u606f\u4e2d\u5fc3\u3002<\/p>\n

    \"\"<\/p>\n

    \u60a8\u53ef\u4ee5\u5728\u4eea\u8868\u677f\u7684\u201c \u7ba1\u7406\u201d\u6807\u7b7e\u4e2d\u627e\u5230\u7528\u6237\u5217\u8868\uff0c\u865a\u62df\u4e3b\u673a\u548c\u7b56\u7565\u3002 \u60a8\u5e94\u8be5\u5220\u9664\u8bbf\u5ba2\u7528\u6237\u7684\u5b89\u5168\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n

    \"\"<\/p>\n

    \u60a8\u53ef\u4ee5\u5728\u201c \u961f\u5217\u201d\u9009\u9879\u5361\u4e2d\u627e\u5230\u6d88\u606f\u961f\u5217\u5217\u8868\u3002 \u60a8\u53ef\u4ee5\u901a\u8fc7\u6b64\u754c\u9762\u521b\u5efa\u65b0\u961f\u5217\u6216\u5220\u9664\u73b0\u6709\u961f\u5217\u3002<\/p>\n

    \"\"<\/p>\n

    \u60a8\u53ef\u4ee5\u5728\u201c \u8fde\u63a5\u201d\u9009\u9879\u5361\u4e0a\u627e\u5230\u5f53\u524d\u8fde\u63a5\u7684\u5217\u8868<\/p>\n

    \"\"<\/p>\n

    \u540c\u6837\uff0c\u60a8\u53ef\u4ee5\u5728\u5404\u81ea\u7684\u9009\u9879\u5361\u4e0a\u627e\u5230\u6e20\u9053\u548c\u4ea4\u6362\u3002<\/p>\n

    \"\"<\/p>\n

    \u7ed3\u8bba<\/strong><\/div>\n

    \u60a8\u73b0\u5728\u53ef\u4ee5\u8f7b\u677e\u5730\u5728\u8fdb\u7a0b\uff0c\u670d\u52a1\u5668\u548c\u5ba2\u6237\u7aef\u4e4b\u95f4\u5b89\u88c5RabbitMQ\u8fdb\u884c\u6d88\u606f\u6392\u961f\u3002 \u8981\u4e86\u89e3\u6709\u5173RabbitMQ\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u53ef\u4ee5\u6d4f\u89c8RabbitMQ\u7ad9\u70b9\u3002<\/p>\n

    \n

    \u539f\u6587\u6765\u81ea\uff1ahttps:\/\/www.howtoing.com\/how-to-install-rabbitmq-server-on-centos-7\/<\/a><\/p>\n

    \u672c\u6587\u5730\u5740\uff1ahttp:\/\/gulass.cn\/install-rabbitmq-on-centos-7.html<\/a>\u7f16\u8f91\uff1a\u5cb3\u6c38\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

    \u5bfc\u8bfb RabbitMQ\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u5f00\u6e90\u4f01\u4e1a\u6d88\u606f\u4ee3\u7406\u8f6f\u4ef6\u3002 \u5b83\u662f\u7528Erlang\u7f16\u5199\u7684\uff0c\u5e76\u5b9e\u73b0\u4e86\u9ad8\u7ea7\u6d88\u606f\u961f\u5217\u534f\u8bae\uff08 […]<\/p>\n","protected":false},"author":63,"featured_media":81345,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-81335","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/81335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=81335"}],"version-history":[{"count":10,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/81335\/revisions"}],"predecessor-version":[{"id":81358,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/81335\/revisions\/81358"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/81345"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=81335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=81335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=81335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}