【Ubuntu 安装指定版本RabbitMQ ※便捷版※】

【Ubuntu 安装指定版本RabbitMQ ※便捷版※】,第1张

【Ubuntu 安装指定版本RabbitMQ ※便捷版※】 Ubuntu 16.04 安装 RabbitMQ 3.7.4 第一步 安装 erlang

需要注意 erlang和rabbitmq的版本比对关系

https://www.rabbitmq.com/which-erlang.html

我这里安装的是RabbitMQ 3.7.4,所以erlang版本安装20.x的即可最小版本19.3也是可以的,我这里安装erlang20.1

在线安装 推荐

直接安装esl-erlang 更完整一些,否则会遇到一堆乱七八糟的问题
添加Key

wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add -

加入源
ubuntu 20

echo "deb https://packages.erlang-solutions.com/ubuntu focal contrib" | sudo tee /etc/apt/sources.list.d/erlang-solution.list

ubuntu 18

echo "deb https://packages.erlang-solutions.com/ubuntu bionic contrib" | sudo tee /etc/apt/sources.list.d/erlang-solution.list

ubuntu 16

echo "deb https://packages.erlang-solutions.com/ubuntu xenial contrib" | sudo tee /etc/apt/sources.list.d/erlang-solution.list

更新

sudo apt update

安装

sudo apt-get install esl-erlang=1:20.1.7
源码安装
wget http://www.erlang.org/download/otp_src_20.1.tar.gz
安装依赖
sudo apt-get install libncurses5-dev
配置
./configure  --prefix=/usr/local/erlang --enable-smp-support  --enable-threads  --enable-sctp --enable-kernel-poll --enable-hipe  --with-ssl --without-javac
编译安装
make && make install
创建软连接
ln -s /usr/local/erlang/lib/erlang/bin/erl /usr/bin/erl 
ln -s /usr/local/erlang/lib/erlang/bin/erlc /usr/bin/erlc
ln -s /usr/local/erlang/lib/erlang/lib/erl_interface-3.10/bin/erl_call /usr/bin/erl_call
运行检查

这里注意版本是否正确

root@leadir-virtual-machine:/home/leadir/Downloads# erl
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [kernel-poll:false]

Eshell V9.1  (abort with ^G)
1> 

至此erlang安装完成

第二步 安装RabbitMQ 3.7.4 环境准备
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | sudo bash

执行结果如下所示:

root@l1234r-virtual-machine:/home/leadir/Downloads# curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | sudo bash
Detected operating system as Ubuntu/xenial.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/rabbitmq_rabbitmq-server.list...done.
importing packagecloud gpg key... done.
Running apt-get update... done.

The repository is setup! You can now install packages.
安装 指定版本
sudo apt-get install rabbitmq-server=3.7.4-1

安装结果如下所示:

root@1234r-virtual-machine:/home/leadir# sudo apt-get install rabbitmq-server=3.7.4-1
Reading package lists... Done
Building dependency tree        
Reading state information... Done
The following NEW packages will be installed:
  rabbitmq-server
0 upgraded, 1 newly installed, 0 to remove and 41 not upgraded.
Need to get 0 B/11.6 MB of archives.
After this operation, 13.4 MB of additional disk space will be used.
Selecting previously unselected package rabbitmq-server.
(Reading database ... 227831 files and directories currently installed.)
Preparing to unpack .../rabbitmq-server_3.7.4-1_all.deb ...
Unpacking rabbitmq-server (3.7.4-1) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Processing triggers for systemd (229-4ubuntu21.28) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up rabbitmq-server (3.7.4-1) ...

如果不知道指定版本的具体版本号可以通过以下指令查询

apt-cache madison rabbitmq-server
验证是否安装成功
systemctl status rabbitmq-server

结果如下

root@l123r-virtual-machine:/home/leadir# systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
   Active: active (running) since 日 2021-12-26 09:31:44 CST; 5min ago
 Main PID: 2327 (beam.smp)
   Status: "Initialized"
   CGroup: /system.slice/rabbitmq-server.service
           ├─2327 /usr/lib/erlang/erts-12.1.5/bin/beam.smp -W w -A 64 -P 1048576 -t 5000000 -stbt db -zdbbl 1280000 -K true -- -root /usr/lib/erlang -progname erl -- -home /var/lib/rabbitmq -- -pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.7.4/
           ├─2412 /usr/lib/erlang/erts-12.1.5/bin/epmd -daemon
           ├─2536 erl_child_setup 1024
           ├─2561 inet_gethost 4
           └─2562 inet_gethost 4

12月 26 09:31:43 leadir-virtual-machine rabbitmq-server[2327]:   ##########  Logs: /var/log/rabbitmq/rabbit@leadir-virtual-machine.log
12月 26 09:31:43 leadir-virtual-machine rabbitmq-server[2327]:                     /var/log/rabbitmq/rabbit@leadir-virtual-machine_upgrade.log
12月 26 09:31:43 leadir-virtual-machine rabbitmq-server[2327]:               Starting broker...
12月 26 09:31:44 leadir-virtual-machine rabbitmq-server[2327]: =INFO REPORT==== 26-Dec-2021::09:31:44.740529 ===
12月 26 09:31:44 leadir-virtual-machine rabbitmq-server[2327]: Limiting to approx 1024 file handles (919 sockets)
12月 26 09:31:44 leadir-virtual-machine rabbitmq-server[2327]: =INFO REPORT==== 26-Dec-2021::09:31:44.807284 ===
12月 26 09:31:44 leadir-virtual-machine rabbitmq-server[2327]: started TCP Listener on [::]:5672
12月 26 09:31:44 leadir-virtual-machine rabbitmq-server[2327]: systemd unit for activation check: "rabbitmq-server.service"
12月 26 09:31:44 leadir-virtual-machine systemd[1]: Started RabbitMQ broker.
12月 26 09:31:46 leadir-virtual-machine rabbitmq-server[2327]:  completed with 0 plugins.
lines 1-22/22 (END)

启用插件
rabbitmq-plugins enable rabbitmq_management
添加设置用户信息

执行命令

rabbitmqctl add_user admin admin  &&
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*" &&
rabbitmqctl set_user_tags admin administrator

执行如下

root@l123r-virtual-machine:/etc/rabbitmq# rabbitmqctl add_user admin admin
Adding user "admin" ...
root@l123r-virtual-machine:/etc/rabbitmq# rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
Setting permissions for user "admin" in vhost "/" ...
root@l123r-virtual-machine:/etc/rabbitmq# rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...
WEB访问


至此 指定版本的RabbitMQ安装完成
参考链接:
Installation instructions
https://rabbitmq.com/management.html

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5682972.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存