rabbtmq 依赖于erlang,rabbitmq 3.7.7 版本对erlang的依赖关系参见:http://www.rabbitmq.com/which-erlang.html erlang版本为21.0.x,因此,需要首先安装21.0.x。考虑到服务器环境可能无法直接与外网环境互通,因此决定采用下载源码自行编译erlang。(基础的yum repo运维是支持的)
1.编译安装erlang
代码语言:javascript复制cd /opt/soft
wget http://erlang.org/download/otp_src_21.0.tar.gz
cd /opt
tar - zxvf otp_src_21.0.tar.gz
在下载完源码之后,进行编译,注意,erlang需要依赖的包有 ncurses-devel 、openssl-devel、unixODBC-devel、gcc-c 。
代码语言:javascript复制#--prefix 指定编译后安装的目录 --without-javac 采用非java编译
./configure --prefix=/opt/erlang --without-javac
可以看到提示部分:
代码语言:javascript复制*********************************************************************
********************** APPLICATIONS DISABLED **********************
*********************************************************************
configure: error: No curses library functions found
configure: error: /bin/sh '/opt/otp_src_21.0/erts/configure' failed for erts
*********************************************************************
*********************************************************************
********************** APPLICATIONS INFORMATION *******************
*********************************************************************
wx : wxWidgets not found, wx will NOT be usable
*********************************************************************
*********************************************************************
********************** DOCUMENTATION INFORMATION ******************
*********************************************************************
documentation :
fop is missing.
Using fakefop to generate placeholder PDF files.
*********************************************************************
需要安装ncurses-devel
代码语言:javascript复制yum -y install ncurses-devel
./configure --prefix=/opt/erlang --without-javac
提示:
代码语言:javascript复制*********************************************************************
********************** APPLICATIONS DISABLED **********************
*********************************************************************
crypto : No usable OpenSSL found
jinterface : Java compiler disabled by user
odbc : ODBC library - link check failed
orber : No C compiler found
ssh : No usable OpenSSL found
ssl : No usable OpenSSL found
需要安装openssl-devel
代码语言:javascript复制yum -y install openssl-devel
./configure --prefix=/opt/erlang --without-javac
提示:
代码语言:javascript复制*********************************************************************
********************** APPLICATIONS DISABLED **********************
*********************************************************************
jinterface : Java compiler disabled by user
orber : No C compiler found
*********************************************************************
需要安装gcc-c
代码语言:javascript复制yum -y install gcc-c
./configure --prefix=/opt/erlang --without-javac
最终提示:
代码语言:javascript复制config.status: creating include/x86_64-unknown-linux-gnu/erl_int_sizes_config.h
*********************************************************************
********************** APPLICATIONS DISABLED **********************
*********************************************************************
jinterface : Java compiler disabled by user
*********************************************************************
*********************************************************************
********************** APPLICATIONS INFORMATION *******************
*********************************************************************
wx : wxWidgets not found, wx will NOT be usable
*********************************************************************
*********************************************************************
********************** DOCUMENTATION INFORMATION ******************
*********************************************************************
documentation :
fop is missing.
Using fakefop to generate placeholder PDF files.
*********************************************************************
注意 APPLICATIONS DISABLED 部分的提示,其他两部分是不影响编译的。 No Java compiler found ,我们可以选择用gcc等其他方式来编译erlang,如果你安装了gcc,这里就用不上java编译了,因此可以在configure时增加 –disable-javac 避免该错误。
代码语言:javascript复制make
make install
稍等片刻即可安装成功,此外,为了使用方便,还可使用一个软连接:
代码语言:javascript复制ln -s /opt/erlang/bin/erl /usr/local/bin/erl
测试:
代码语言:javascript复制erl
Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Eshell V10.0 (abort with ^G)
1>
erl安装成功。
2.安装rabbitmq
下载通用安装包
代码语言:javascript复制wget https://akamai.bintray.com/64/640fc5d0b10705f838419191bbf917e66f3ff5eb35f07fc51c2f197fda0aa170?__gda__=exp=1530957710~hmac=6af54ca017b6fae8e04b64c984bc017959e07afdbdc8d3879866b139a33d9292&response-content-disposition=attachment;filename="rabbitmq-server-generic-unix-3.7.7.tar.xz"&response-content-type=application/x-xz&requestInfo=U2FsdGVkX1_eFHEzyK3D7PXVMbDHIPfdzVdK4Q_LLLngjq1JJJl_5tlhcw6ktmi5IW8D6hha51CqLD-KaDhKxUpLEPF3FOJLyMsr2mclgrvQvldL4f6X25oqy17aOWcB8w0eBZxjWLWM4ImCKkBGq71SGPN7mu72F8JT9gDiMXX1z6sBCDXtSdec5CJJP1je&response-X-Checksum-Sha1=a3aa29d46218899cbf597a913493a5c9abc1a6ba&response-X-Checksum-Sha2=640fc5d0b10705f838419191bbf917e66f3ff5eb35f07fc51c2f197fda0aa170
建用户
代码语言:javascript复制useradd rabbitmq -d /opt/rabbitmq
修改limit.conf
代码语言:javascript复制vim /etc/security/limit.conf
增加如下内容:
代码语言:javascript复制rabbitmq soft nproc 16384
rabbitmq hard nproc 16384
rabbitmq soft nofile 65535
rabbitmq hard nofile 65536
切换到rabbitmq
代码语言:javascript复制sudo su - rabbitmq
xz -d ./rabbitmq-server-generic-unix-3.7.7.tar.xz
tar -xvf ./rabbitmq-server-generic-unix-3.7.7.tar
ln -s /opt/rabbitmq/rabbitmq_server-3.7.7 /opt/rabbitmq/rabbitmq
启动rabbitmq
代码语言:javascript复制cd rabbitmq/sbin
./rabbitmq-server start
开启管理界面
代码语言:javascript复制./rabbitmq-plugins list
./rabbitmq-plugins enable rabbitmq_management
./rabbitmqctl add_user rabbitmq rabbitmq
./rabbitmqctl set_user_tags rabbitmq administrator
执行过程:
代码语言:javascript复制[rabbitmq@m162p239 sbin]$ ./rabbitmq-plugins list
Configured: E = explicitly enabled; e = implicitly enabled
| Status: * = running on rabbit@m162p239
|/
[ ] rabbitmq_amqp1_0 3.7.7
[ ] rabbitmq_auth_backend_cache 3.7.7
[ ] rabbitmq_auth_backend_http 3.7.7
[ ] rabbitmq_auth_backend_ldap 3.7.7
[ ] rabbitmq_auth_mechanism_ssl 3.7.7
[ ] rabbitmq_consistent_hash_exchange 3.7.7
[ ] rabbitmq_event_exchange 3.7.7
[ ] rabbitmq_federation 3.7.7
[ ] rabbitmq_federation_management 3.7.7
[ ] rabbitmq_jms_topic_exchange 3.7.7
[ ] rabbitmq_management 3.7.7
[ ] rabbitmq_management_agent 3.7.7
[ ] rabbitmq_mqtt 3.7.7
[ ] rabbitmq_peer_discovery_aws 3.7.7
[ ] rabbitmq_peer_discovery_common 3.7.7
[ ] rabbitmq_peer_discovery_consul 3.7.7
[ ] rabbitmq_peer_discovery_etcd 3.7.7
[ ] rabbitmq_peer_discovery_k8s 3.7.7
[ ] rabbitmq_random_exchange 3.7.7
[ ] rabbitmq_recent_history_exchange 3.7.7
[ ] rabbitmq_sharding 3.7.7
[ ] rabbitmq_shovel 3.7.7
[ ] rabbitmq_shovel_management 3.7.7
[ ] rabbitmq_stomp 3.7.7
[ ] rabbitmq_top 3.7.7
[ ] rabbitmq_tracing 3.7.7
[ ] rabbitmq_trust_store 3.7.7
[ ] rabbitmq_web_dispatch 3.7.7
[ ] rabbitmq_web_mqtt 3.7.7
[ ] rabbitmq_web_mqtt_examples 3.7.7
[ ] rabbitmq_web_stomp 3.7.7
[ ] rabbitmq_web_stomp_examples 3.7.7
[rabbitmq@m162p239 sbin]$ ./rabbitmq-plugins enable rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@m162p239...
The following plugins have been enabled:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
started 3 plugins.
[rabbitmq@m162p239 sbin]$ ./rabbitmqctl add_user rabbitmq rabbitmq
Adding user "rabbitmq" ...
[rabbitmq@m162p239 sbin]$ ./rabbitmqctl set_user_tags rabbitmq administrator
Setting tags for user "rabbitmq" to [administrator] ...
[rabbitmq@m162p239 sbin]$ ./rabbitmq-plugins list
Configured: E = explicitly enabled; e = implicitly enabled
| Status: * = running on rabbit@m162p239
|/
[ ] rabbitmq_amqp1_0 3.7.7
[ ] rabbitmq_auth_backend_cache 3.7.7
[ ] rabbitmq_auth_backend_http 3.7.7
[ ] rabbitmq_auth_backend_ldap 3.7.7
[ ] rabbitmq_auth_mechanism_ssl 3.7.7
[ ] rabbitmq_consistent_hash_exchange 3.7.7
[ ] rabbitmq_event_exchange 3.7.7
[ ] rabbitmq_federation 3.7.7
[ ] rabbitmq_federation_management 3.7.7
[ ] rabbitmq_jms_topic_exchange 3.7.7
[E*] rabbitmq_management 3.7.7
[e*] rabbitmq_management_agent 3.7.7
[ ] rabbitmq_mqtt 3.7.7
[ ] rabbitmq_peer_discovery_aws 3.7.7
[ ] rabbitmq_peer_discovery_common 3.7.7
[ ] rabbitmq_peer_discovery_consul 3.7.7
[ ] rabbitmq_peer_discovery_etcd 3.7.7
[ ] rabbitmq_peer_discovery_k8s 3.7.7
[ ] rabbitmq_random_exchange 3.7.7
[ ] rabbitmq_recent_history_exchange 3.7.7
[ ] rabbitmq_sharding 3.7.7
[ ] rabbitmq_shovel 3.7.7
[ ] rabbitmq_shovel_management 3.7.7
[ ] rabbitmq_stomp 3.7.7
[ ] rabbitmq_top 3.7.7
[ ] rabbitmq_tracing 3.7.7
[ ] rabbitmq_trust_store 3.7.7
[e*] rabbitmq_web_dispatch 3.7.7
[ ] rabbitmq_web_mqtt 3.7.7
[ ] rabbitmq_web_mqtt_examples 3.7.7
[ ] rabbitmq_web_stomp 3.7.7
[ ] rabbitmq_web_stomp_examples 3.7.7
[rabbitmq@m162p239 sbin]$
然后访问后台 http://192.168.162.239:15672 用 rabbitmq rabbitmq 登陆即可