
在 Linux 系统上安装 RabbitMQ 并确保其稳定运行,对于构建可靠的分布式消息系统至关重要。本文将详细介绍如何在 Linux 系统上安装 RabbitMQ,并提供关键的注意事项,帮助您避免常见的坑点,确保安装过程顺利。
sudo yum updatesudo apt-get updatesudo yum install -y wget curlsudo apt-get install -y wget curlRabbitMQ 基于 Erlang 语言开发,因此需要先安装 Erlang。
sudo wget https://packages.erlang-solutions.com/erlang Solutions/signing-key.pub
sudo rpm -import signing-key.pub
sudo wget https://packages.erlang-solutions.com/erlang-solutions-epel-2.el7.noarch.rpm
sudo rpm -Uvh erlang-solutions-epel-2.el7.noarch.rpmsudo yum install -y esl-erlangsudo curl -fsSL https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo gpg --dearmor -o /usr/share/keyrings/erlang-solutions-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/erlang-solutions-archive-keyring.gpg] https://packages.erlang-solutions.com/ubuntu $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list.d/erlang-solutions.list
sudo apt-get updatesudo apt-get install -y esl-erlangsudo wget https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sudo rpm --import rabbitmq-release-signing-key.asc
sudo wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.11.16/rabbitmq-server-3.11.16-1.el8.x86_64.rpm
sudo rpm -ivh rabbitmq-server-3.11.16-1.el8.x86_64.rpmsudo yum install -y rabbitmq-serversudo apt-get install -y apt-transport-https
sudo curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | sudo gpg --dearmor -o /usr/share/keyrings/rabbitmq-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/rabbitmq-archive-keyring.gpg] https://dl.bintray.com/rabbitmq-gh/rabbitmq-server/debian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list
sudo apt-get updatesudo apt-get install -y rabbitmq-serversudo systemctl start rabbitmq-serversudo systemctl enable rabbitmq-serversudo systemctl status rabbitmq-serversudo rabbitmq-plugins enable rabbitmq_managementsudo firewall-cmd --zone=public --add-port=15672/tcp --permanent
sudo firewall-cmd --zone=public --add-port=5672/tcp --permanent
sudo firewall-cmd --reloadsudo rabbitmqctl add_user admin admin123sudo rabbitmqctl set_user_tags admin administratorsudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"打开浏览器,输入 http://<服务器 IP 地址>:15672 访问 RabbitMQ 的管理界面,使用刚才创建的 “admin” 用户登录。
sudo ss -tulnp | grep 25672
sudo kill -9 <进程 ID>sudo yum install ncurses-devel通过以上步骤,您可以在 Linux 系统上成功安装并配置 RabbitMQ,并采取相应的注意事项来避免常见问题。希望本文对您有所帮助,如果您在安装过程中遇到任何问题,欢迎随时联系。
以上内容为您提供了一个简洁且详细的 RabbitMQ 安装教程,帮助您在 Linux 系统上顺利完成安装并配置 RabbitMQ,确保其稳定运行。