首先我的安装环境是linux centOS8
按顺序输入一下命令
cd /etc/yum.repos.d/ #进入yum目录
ll # 查看是否存在rabbitmq_erlang.repo
vim rabbitmq_erlang.repo
rabbitmq_erlang.repo中的内容可以根据rabbitmq官网提供根据自己的操作系统复制对应的配置信息,我使用的是CentOS8的配置,复制的时候注意不要漏掉一个字符;如下:
[rabbitmq-rabbitmq-erlang]
name=rabbitmq-rabbitmq-erlang
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/8/$basearch
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
[rabbitmq-rabbitmq-erlang-noarch]
name=rabbitmq-rabbitmq-erlang-noarch
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/8/noarch
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
[rabbitmq-rabbitmq-erlang-source]
name=rabbitmq-rabbitmq-erlang-source
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/8/SRPMS
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
##
## RabbitMQ Server
##
[rabbitmq_server]
name=rabbitmq-rabbitmq-server
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/rpm/el/8/$basearch
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
[rabbitmq_server-noarch]
name=rabbitmq-rabbitmq-server-noarch
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/rpm/el/8/noarch
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
[rabbitmq_server-source]
name=rabbitmq-rabbitmq-server-source
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/rpm/el/8/SRPMS
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
保存并退出文件
开始安装,使用命令:
yum install erlang
如果有类似这样的错误,可能和你系统的版本以及yum环境有关。可以重新修改配置文件,以及执行
yum update -y #更新元数据包
安装的过程中,会有一些提示y/N,全部输y
安装完成,最后提示Complete!
验证Erlang安装完成,通过命令
erl
退出使用halt().
,其中最后的句号(.)不能少
推荐使用官方命令
rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
## install these dependencies from standard OS repositories
yum install socat logrotate -y
# This example assumes the CentOS 8 version of the package.
# For CentOS 7, replace "el8" with "el7".
yum install rabbitmq-server-3.8.14-1.el8.noarch.rpm
则可以先将安装包下载到本地,然后上传到服务器 ,网址是:https://www.rabbitmq.com/install-rpm.html#downloads
然后执行命令,其中/usr/local/
是我放安装包的位置
yum install /usr/local/rabbitmq-server-3.8.14-1.el8.noarch.rpm
普通启动
systemctl start rabbitmq-server.service
设置为开机自启动
systemctl enable rabbitmq-server.service
systemctl status rabbitmq-server
rabbitmq-plugins enable rabbitmq_management
这个时候直接运行ip地址:15672
会直接报错
先在对应服务器厂商设置服务器安全组,将15672端口放行:
如同这样此处是腾讯云服务器
如果再次访问任然报错,则可能是服务器防火墙的原因,我们需要进行修改一下,命令如下,分别执行
firewall-cmd --add-port=15672/tcp --permanent
firewall-cmd --add-port=5672/tcp --permanent
firewall-cmd --reload
然后我们使用浏览器访问地址:ip地址:15672
,这个时候就会展示如下页面:
这个时候我们就需要设置一下账户用于登录
设置账户命令如下
rabbitmqctl add_user 要添加账号 账户的密码
rabbitmqctl set_permissions -p / 刚刚添加的账号 ".*" ".*" ".*"
rabbitmqctl set_user_tags 刚刚添加的账号 administrator
再次通过你刚才设置的账号密码登录,你就会发现成功了,