CentOS7下安装RabbitMQ

由于在CentOS环境安装RabbitMQ 极度麻烦,所以要写下这个过程,以免以后忘记再次麻烦多一次。

由于 RabbitMQ 使用通过 Erlang 来开发的,需要需要安装Erlang 然而在安装Erlang 又一大波依赖需要安装,而且这些依赖不在CentOS 默认的yum 库中。所以就郁闷了。

我这次全程都会使用yum来按照,所以准备好yum

首先呢 恶心一下 先尝试来安装 erlang

添加Erlang Solutions key 支持

[root@localhost ~]# rpm --import http://binaries.erlang-solutions.com/debian/erlang_solutions.asc 

[root@localhost ~]# wget http://binaries.erlang-solutions.com/rpm/centos/erlang_solutions.repo  
--2016-11-04 11:45:16--  http://binaries.erlang-solutions.com/rpm/centos/erlang_solutions.repo
正在解析主机 binaries.erlang-solutions.com (binaries.erlang-solutions.com)... 31.172.186.53
正在连接 binaries.erlang-solutions.com (binaries.erlang-solutions.com)|31.172.186.53|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:http://packages.erlang-solutions.com/rpm/centos/erlang_solutions.repo [跟随至新的 URL]
--2016-11-04 11:45:16--  http://packages.erlang-solutions.com/rpm/centos/erlang_solutions.repo
正在解析主机 packages.erlang-solutions.com (packages.erlang-solutions.com)... 31.172.186.53
再次使用存在的到 binaries.erlang-solutions.com:80 的连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:245
正在保存至: “erlang_solutions.repo”

100%[=====================================>] 245         --.-K/s 用时 0s      

2016-11-04 11:45:18 (49.7 MB/s) - 已保存 “erlang_solutions.repo” [245/245])

[root@localhost ~]# mv erlang_solutions.repo /etc/yum.repos.d/

因为由于centos 原来的库没有erlang所需的依赖 所以安装一下 RPMforge 但是我看了一下 CentOS 官网 发现 他们已经不推荐使用RPMfoge 也告诉我们这个项目已经没有继续维护了,因为我在很多个渠道中也无法获得这个rpm文件 然后看了一下CentOS 所推荐的第三方库 然后我选择了这个:

http://rpmfusion.org/Configuration

那我就用了这个rmpfusion 这个第三方库。在安装之前需要按安装一下它所依赖的epel-release 所以先yum 一下

[root@localhost ~]# yum install epel-release
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.cn99.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-6 将被 安装
--> 解决依赖关系完成

依赖关系解决

===============================================================================
 Package                架构             版本           源                大小
===============================================================================
正在安装:
 epel-release           noarch           7-6            extras            14 k

事务概要
===============================================================================
安装  1 软件包

总下载量:14 k
安装大小:24 k
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/extras/packages/epel-release-7-6.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
epel-release-7-6.noarch.rpm 的公钥尚未安装
epel-release-7-6.noarch.rpm                               |  14 kB   00:00     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
 用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 软件包     : centos-release-7-2.1511.el7.centos.2.10.x86_64 (@anaconda)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : epel-release-7-6.noarch                                    1/1 
  验证中      : epel-release-7-6.noarch                                    1/1 

已安装:
  epel-release.noarch 0:7-6                                                    

完毕!

然后开始安装 rpmfusion :

[root@localhost ~]# rpm -ivh https://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
获取https://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
警告:/var/tmp/rpm-tmp.maBr5M: 头V3 RSA/SHA256 Signature, 密钥 ID 849c449f: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:rpmfusion-free-release-6-1       ################################# [100%]

然后开始按照 erlang

[root@localhost ~]# yum install erlang

其实什么要搞这么多东西不直接了当安装erlang 我也想啊 但是CentOS本来的yum 没有erlang所依赖的东西啊。所以要安装一下第三方库。

所需要的第三方库【这个可以了解一下不用命令去下载 yum install erlang 会自动下载所需的库的】:

unixODBC | unixODBC-devel | wxBase | wxGTK | SDL | wxGTK-gl

安装后提示安装了这些依赖:

SDL.x86_64 0:1.2.15-14.el7                                                   
  erlang-asn1.x86_64 0:19.1-1.el7.centos                                       
  erlang-common_test.x86_64 0:19.1-1.el7.centos                                
  erlang-compiler.x86_64 0:19.1-1.el7.centos                                   
  erlang-cosEvent.x86_64 0:19.1-1.el7.centos                                   
  erlang-cosEventDomain.x86_64 0:19.1-1.el7.centos                             
  erlang-cosFileTransfer.x86_64 0:19.1-1.el7.centos                            
  erlang-cosNotification.x86_64 0:19.1-1.el7.centos                            
  erlang-cosProperty.x86_64 0:19.1-1.el7.centos                                
  erlang-cosTime.x86_64 0:19.1-1.el7.centos                                    
  erlang-cosTransactions.x86_64 0:19.1-1.el7.centos                            
  erlang-crypto.x86_64 0:19.1-1.el7.centos                                     
  erlang-debugger.x86_64 0:19.1-1.el7.centos                                   
  erlang-dialyzer.x86_64 0:19.1-1.el7.centos                                   
  erlang-diameter.x86_64 0:19.1-1.el7.centos                                   
  erlang-edoc.x86_64 0:19.1-1.el7.centos                                       
  erlang-eldap.x86_64 0:19.1-1.el7.centos                                      
  erlang-erl_docgen.x86_64 0:19.1-1.el7.centos                                 
  erlang-erl_interface.x86_64 0:19.1-1.el7.centos                              
  erlang-erts.x86_64 0:19.1-1.el7.centos                                       
  erlang-et.x86_64 0:19.1-1.el7.centos                                         
  erlang-eunit.x86_64 0:19.1-1.el7.centos                                      
  erlang-examples.x86_64 0:19.1-1.el7.centos                                   
  erlang-gs.x86_64 0:19.1-1.el7.centos                                         
  erlang-hipe.x86_64 0:19.1-1.el7.centos                                       
  erlang-ic.x86_64 0:19.1-1.el7.centos                                         
  erlang-inets.x86_64 0:19.1-1.el7.centos                                      
  erlang-jinterface.x86_64 0:19.1-1.el7.centos                                 
  erlang-kernel.x86_64 0:19.1-1.el7.centos                                     
  erlang-megaco.x86_64 0:19.1-1.el7.centos                                     
  erlang-mnesia.x86_64 0:19.1-1.el7.centos                                     
  erlang-observer.x86_64 0:19.1-1.el7.centos                                   
  erlang-odbc.x86_64 0:19.1-1.el7.centos                                       
  erlang-orber.x86_64 0:19.1-1.el7.centos                                      
  erlang-os_mon.x86_64 0:19.1-1.el7.centos                                     
  erlang-otp_mibs.x86_64 0:19.1-1.el7.centos                                   
  erlang-parsetools.x86_64 0:19.1-1.el7.centos                                 
  erlang-percept.x86_64 0:19.1-1.el7.centos                                    
  erlang-public_key.x86_64 0:19.1-1.el7.centos                                 
  erlang-reltool.x86_64 0:19.1-1.el7.centos                                    
  erlang-runtime_tools.x86_64 0:19.1-1.el7.centos                              
  erlang-sasl.x86_64 0:19.1-1.el7.centos                                       
  erlang-snmp.x86_64 0:19.1-1.el7.centos                                       
  erlang-ssh.x86_64 0:19.1-1.el7.centos                                        
  erlang-ssl.x86_64 0:19.1-1.el7.centos                                        
  erlang-stdlib.x86_64 0:19.1-1.el7.centos                                     
  erlang-syntax_tools.x86_64 0:19.1-1.el7.centos                               
  erlang-tools.x86_64 0:19.1-1.el7.centos                                      
  erlang-typer.x86_64 0:19.1-1.el7.centos                                      
  erlang-wx.x86_64 0:19.1-1.el7.centos                                         
  erlang-xmerl.x86_64 0:19.1-1.el7.centos                                      
  tcl.x86_64 1:8.5.13-8.el7                                                    
  tk.x86_64 1:8.5.13-6.el7                                                     
  unixODBC.x86_64 0:2.3.1-11.el7                                               
  wxBase.x86_64 0:2.8.12-20.el7                                                
  wxGTK.x86_64 0:2.8.12-20.el7                                                 
  wxGTK-gl.x86_64 0:2.8.12-20.el7

最后下载好你的rabbitMQ rpm 或者你可以直接使用yum 安装也可以 我就懒得搞直接用rpm的方式去安装算了。

然后提示我需要另外一个依赖 socat 然后继续yum 一下:

[root@localhost ~]# rpm -ivh  http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.5/rabbitmq-server-3.6.5-1.noarch.rpm
获取http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.5/rabbitmq-server-3.6.5-1.noarch.rpm
警告:/var/tmp/rpm-tmp.gNKhnj: 头V4 RSA/SHA1 Signature, 密钥 ID 6026dfca: NOKEY
错误:依赖检测失败:
    socat 被 rabbitmq-server-3.6.5-1.noarch 需要
[root@localhost ~]# yum install socat
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirror01.idc.hinet.net
 * extras: mirrors.aliyun.com
 * rpmfusion-free-updates: mirror.bjtu.edu.cn
 * updates: mirrors.cn99.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 socat.x86_64.0.1.7.2.2-5.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

===============================================================================
 Package         架构             版本                    源              大小
===============================================================================
正在安装:
 socat           x86_64           1.7.2.2-5.el7           base           255 k

事务概要
===============================================================================
安装  1 软件包

总下载量:255 k
安装大小:924 k
Is this ok [y/d/N]: y
Downloading packages:
socat-1.7.2.2-5.el7.x86_64.rpm                            | 255 kB   00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : socat-1.7.2.2-5.el7.x86_64                                 1/1 
  验证中      : socat-1.7.2.2-5.el7.x86_64                                 1/1 

已安装:
  socat.x86_64 0:1.7.2.2-5.el7                                                 

完毕!

然后安装:

[root@localhost ~]# wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.5/rabbitmq-server-3.6.5-1.noarch.rpm
--2016-11-04 14:13:10--  http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.5/rabbitmq-server-3.6.5-1.noarch.rpm
正在解析主机 www.rabbitmq.com (www.rabbitmq.com)... 192.240.153.117
正在连接 www.rabbitmq.com (www.rabbitmq.com)|192.240.153.117|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:5520417 (5.3M) [application/x-RedHat-package-manager]
正在保存至: “rabbitmq-server-3.6.5-1.noarch.rpm”

100%[=====================================>] 5,520,417    113KB/s 用时 82s    

2016-11-04 14:14:34 (65.9 KB/s) - 已保存 “rabbitmq-server-3.6.5-1.noarch.rpm” [5520417/5520417])

[root@localhost ~]# rpm -ivh rabbitmq-server-3.6.5-1.noarch.rpm 
警告:rabbitmq-server-3.6.5-1.noarch.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID 6026dfca: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:rabbitmq-server-3.6.5-1          ################################# [100%]

启动一下服务:

[root@localhost ~]# service rabbitmq-server start
Starting rabbitmq-server (via systemctl):                  [  确定  ]
[root@localhost ~]# rabbitmqctl status
Status of node rabbit@localhost ...
[{pid,111980},
 {running_applications,[{rabbit,"RabbitMQ","3.6.5"},
                        {mnesia,"MNESIA  CXC 138 12","4.14.1"},
                        {ranch,"Socket acceptor pool for TCP protocols.",
                               "1.2.1"},
                        {rabbit_common,[],"3.6.5"},
                        {os_mon,"CPO  CXC 138 46","2.4.1"},
                        {xmerl,"XML parser","1.3.12"},
                        {sasl,"SASL  CXC 138 11","3.0.1"},
                        {stdlib,"ERTS  CXC 138 10","3.1"},
                        {kernel,"ERTS  CXC 138 10","5.1"}]},
 {os,{unix,linux}},
 {erlang_version,"Erlang/OTP 19 [erts-8.1] [source-77fb4f8] [64-bit] [async-threads:64] [hipe] [kernel-poll:true]\n"},
 {memory,[{total,44257520},
          {connection_readers,0},
          {connection_writers,0},
          {connection_channels,0},
          {connection_other,0},
          {queue_procs,2688},
          {queue_slave_procs,0},
          {plugins,0},
          {other_proc,18667352},
          {mnesia,58168},
          {mgmt_db,0},
          {msg_index,39080},
          {other_ets,947536},
          {binary,20448},
          {code,17857909},
          {atom,752561},
          {other_system,5911778}]},
 {alarms,[]},
 {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,765403136},
 {disk_free_limit,50000000},
 {disk_free,25630208000},
 {file_descriptors,[{total_limit,924},
                    {total_used,2},
                    {sockets_limit,829},
                    {sockets_used,0}]},
 {processes,[{limit,1048576},{used,137}]},
 {run_queue,0},
 {uptime,14},
 {kernel,{net_ticktime,60}}]
[root@localhost ~]#

然后就没有然后了。

RabbitMQ 的详细介绍:请点这里
RabbitMQ 的下载地址:请点这里

相关推荐