简介
RabblitMQ 官网地址:https://www.rabbitmq.com/
安装概要
系统 | Erlang版本 | RabbitMQ 版本 |
---|
CentOS 7 | 24.0 | 3.9.7 |
官网上 RabbitMQ 与 Erlang 的版本对应关系
https://www.rabbitmq.com/which-erlang.html
有关发行说明
https://www.rabbitmq.com/versions.html
Centos 7 安装 Erlang
erlang solutions 地址:https://www.erlang-solutions.com/downloads/
安装 wget,用于下载
yum install -y wget
推荐 yum 方式 安装简单快捷
yum 方式安装
wget https://packages.erlang-solutions.com/erlang-solutions-2.0-1.noarch.rpm
rpm -Uvh erlang-solutions-2.0-1.noarch.rpm
执行后可以看到 /etc/yum.repos.d/ 目录新增 erlang_solutions.repo 这个文件,内容与官网一致
rpm --import https://packages.erlang-solutions.com/rpm/erlang_solutions.asc
sudo yum install erlang
安装完成 Erlang 安装在 /usr/lib64/erlang 目录下
查看 Erlang 版本
[root@localhost local]
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1]
Eshell V12.0.3 (abort with ^G)
1>
源码方式安装
erlang官网下载地址:https://www.erlang.org/downloads 可以下载后,传到系统中,这里我选择直接 wget 下载
切换目录用于存放下载的压缩包
cd /usr/local/
下载
wget http://erlang.org/download/otp_src_24.1.tar.gz
解压
tar zxf otp_src_24.1.tar.gz
切换到解压的目录
cd otp_src_24.1
创建即将安装的目录
mkdir ../erlang
安装 gcc
yum install -y gcc gcc-c++
./configure --prefix=/usr/local/erlang
configure: error: No curses library functions found
checking for tgetent in -ltermlib... no
configure: error: No curses library functions found
ERROR: /usr/local/otp_src_24.1/erts/configure failed!
Killed
需要安装
yum -y install ncurses-devel
剩余因缺少依赖产生的一些提示
configure: WARNING: Can not find C++ compiler
configure: WARNING: No OpenGL headers found, wx will NOT be usable
configure: WARNING: No GLU headers found, wx will NOT be usable
configure: WARNING:
wxWidgets must be installed on your system.
*********************************************************************
********************** APPLICATIONS DISABLED **********************
*********************************************************************
crypto : No usable OpenSSL found
jinterface : No Java compiler found
odbc : ODBC library - link check failed
ssh : No usable OpenSSL found
ssl : No usable OpenSSL found
警告可以忽略,重点是 APPLICATIONS DISABLED 下的内容
安装 opensll
yum install -y openssl openssl-devel
安装 odbc
yum -y install unixODBC-devel
No Java compiler found 这个如果使用 gcc 编译,可以忽略它
依赖库都安装完成之后,再使用忽略 java 的配置命令
./configure --prefix=/usr/erlang --without-javac
剩下的 警告不用管
wx : No OpenGL headers found, wx will NOT be usable
No GLU headers found, wx will NOT be usable
wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available
wxWidgets must be installed on your system.
Please check that wx-config is in path, the directory
where wxWidgets libraries are installed (returned by
'wx-config --libs' or 'wx-config --static --libs' command)
is in LD_LIBRARY_PATH or equivalent variable and
wxWidgets version is 3.0.2 or above.
erts :
JIT disabled due to lack of compiler with C++17 support
*********************************************************************
*********************************************************************
********************** DOCUMENTATION INFORMATION ******************
*********************************************************************
documentation :
fop is missing.
Using fakefop to generate placeholder PDF files.
*********************************************************************
编译
make && make install
配置环境变量并且使环境变量生效
echo 'export PATH=$PATH:/usr/local/erlang/bin' >> /etc/profile
source /etc/profile
RabbitMQ 安装
导入 RabbitMQ 源
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.9.7/rabbitmq-server-3.9.7-1.el7.noarch.rpm
rpm -Uvh --nodeps rabbitmq-server-3.9.7-1.el7.noarch.rpm
安装 RabbitMQ 公共库秘钥
rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
Rabbitmq 相关命令
启动 RabbitMQ
rabbitmq-server
以守护程序启动
systemctl start rabbitmq-server
查看服务状态
systemctl status rabbitmq-server
暂时关闭 RabbitMQ
systemctl stop rabbitmq-server
可以看到服务状态 变成了 dead Active: inactive (dead) since Thu 2021-10-07 23:07:17 CST; 1min 43s ago
服务重启
systemctl restart rabbitmq-server
设置开机自启
systemctl enable rabbitmq-server
安装图形化页面
rabbitmq-plugins enable rabbitmq_management
默认只有 guest,并且只能本地登录,创建用于远程登录的用户 admin
rabbitmqctl list_users
用户名密码均为 admin
rabbitmqctl add_user admin admin
授予 admin 超级管理员权限
rabbitmqctl set_user_tags admin administrator
|