参考链接:
http://www.rabbitmq.com/install-rpm.html
http://blog.csdn.net/yunfeng482/article/details/72853983
系统版本:
http://www.rabbitmq.com/install-rpm.html
RabbitMQ和centos版本搭配图:
RabbitMQ和Erlang搭配图:
http://www.rabbitmq.com/which-erlang.html
1、 安装ncurses devel
在线安装或源码安装
1)在线安装命令:yum install ncurses devel
2)通过源码安装方式解决同样问题请往下看
下载地址:http://ftp.gnu.org/gnu/ncurses/
我选择的是最新版本:http://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz
[root@localhost rabbitmq]# tar -zxvf ncurses-6.0.tar.gz
[root@localhost rabbitmq]]# cd ncurses-6.0
[root@localhost rabbitmq]]# ./configure --with-shared --without-debug--without-ada --enable-overwrite
[root@localhost rabbitmq]]# make
[root@localhost rabbitmq]]# makeinstall
PS:如出现提示warning: usermockbuild does not exist - using root
warning: group mockbuild does not exist -using root
处理方法如下:
[root@localhostrabbitmq]# groupadd mockbuild
[root@localhost rabbitmq]# useradd mockbuild -g mockbuild
2、socat的安装
1)下载socat源代码包:http://www.dest-unreach.org/socat/download/
2)解压:http://www.dest-unreach.org/socat/download/socat-1.7.3.2.tar.gz
tar –zxvf socat-1.7.3.2.tar.gz
cd socat-1.7.3.2
3)make make install
[root@localhost socat-1.7.3.2]# ./configure
[root@localhost socat-1.7.3.2]# make
[root@localhost socat-1.7.3.2]# make install
3、 安装openssl
1)下载openssl源码
wgethttp://www.openssl.org/source/openssl-1.0.1f.tar.gz
tar zxvfopenssl-1.0.1f.tar.gz
2)进入源码目录,如果不是新下载解压的目录,而且以前有编译安装过的,进入目录后执行make clean以确保能重新编译
cdopenssl-1.0.1f
3)为了不要和已安装的openssl混淆,这里指定一个新的安装目录
./config--prefix=/opt/ssl
4)config之后,会生成Makefile,打开Makefile找到gcc(在62行),在CFLAG参数列表里加上-fPIC
vimMakefile
CC=gcc
CFLAG=-fPIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H-Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_IA32_SSE2-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM-DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM-DWHIRLPOOL_ASM -DGHASH_ASM
5)编译并安装
make&& make install
4、 安装Erlang,他的安装包是otp_src_20.0.tar.gz
下载链接:http://www.erlang.org/downloads
我这里下载的是:otp_src_20.0.tar.gz,
下载地址http://erlang.org/download/otp_src_20.0.tar.gz
1)现在进入你的erlang源码安装目录,如果已经编译安装过erlang,为确保能重新编译,先执行:
makeclean
2)加上openssl安装路径重新configure,如果有安装多个版本的erlang,为了可以方便找到新安装的erl,这里可以指定一个新的安装目录,示例如下:
./configure--with-ssl=/opt/ssl/ --prefix=/opt/erlang
3)编译并安装
make&& make install
4)运行刚才安装的erlang
[root@localhost otp_src_20.0]#/opt/erlang/bin/erl
Erlang/OTP 20 [erts-9.0] [source][64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V9.0 (abort with ^G)
1> crypto:start()
1> .
ok
2>
5、 安装RabbitMQ
1) rpm无依赖安装
[root@localhost rabbitmq]# rpm -ivhrabbitmq-server-3.6.12-1.el6.noarch.rpm--nodeps
Preparing...########################################### [100%]
1:rabbitmq-server########################################### [100%]
2) 创建erlang命令的软链接:
[root@localhost rabbitmq-server-3.6.12]# ln -s /opt/erlang/bin/erl /usr/bin/erl
3) 给RabbitMQ复制配置文件
[root@localhost rabbitmq]# cp /usr/share/doc/rabbitmq-server-3.6.12/rabbitmq.config.example/etc/rabbitmq/rabbitmq.config
4) 启动RabbitMQ
[root@localhost rabbitmq]#service rabbitmq-server start
Startingrabbitmq-server: SUCCESS
rabbitmq-server.
[root@localhostrabbitmq]# ps -ef | grep rabbitmq
rabbitmq21430 1 0 14:44 ? 00:00:00/opt/erlang/lib/erlang/erts-9.0/bin/epmd -daemon
root 214651 0 14:44 pts/1 00:00:00 /bin/sh/etc/init.d/rabbitmq-server start
root 21469 21465 0 14:44 pts/1 00:00:00 /bin/bash -c ulimit -S -c 0>/dev/null 2>&1 ; /usr/sbin/rabbitmq-server
root 21472 21469 0 14:44 pts/1 00:00:00 /bin/sh /usr/sbin/rabbitmq-server
root 21490 21472 0 14:44 pts/1 00:00:00 su rabbitmq -s /bin/sh -c/usr/lib/rabbitmq/bin/rabbitmq-server
rabbitmq21493 21490 0 14:44 ? 00:00:00 /bin/sh/usr/lib/rabbitmq/bin/rabbitmq-server
rabbitmq21697 21493 12 14:44 ? 00:00:06/opt/erlang/lib/erlang/erts-9.0/bin/beam.smp -W w -A 64 -P 1048576 -t 5000000-stbt db -zdbbl 128000 -K true -B i -- -root /opt/erlang/lib/erlang -prognameerl -- -home /var/lib/rabbitmq -- -pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.12/ebin-noshell -noinput -s rabbit boot -sname rabbit@localhost -boot start_sasl-config /etc/rabbitmq/rabbitmq -kernel inet_default_connect_options[{nodelay,true}] -sasl errlog_type error -sasl sasl_error_logger false -rabbiterror_logger {file,"/var/log/rabbitmq/rabbit@localhost.log"} -rabbitsasl_error_logger{file,"/var/log/rabbitmq/rabbit@localhost-sasl.log"} -rabbitenabled_plugins_file "/etc/rabbitmq/enabled_plugins" -rabbitplugins_dir "/usr/lib/rabbitmq/plugins:/usr/lib/rabbitmq/lib/rabbitmq_server-3.6.12/plugins"-rabbit plugins_expand_dir"/var/lib/rabbitmq/mnesia/rabbit@localhost-plugins-expand" -os_monstart_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false-mnesia dir "/var/lib/rabbitmq/mnesia/rabbit@localhost" -kernelinet_dist_listen_min 25672 -kernel inet_dist_listen_max 25672
rabbitmq21803 21697 0 14:44 ? 00:00:00 erl_child_setup 1024
rabbitmq21863 21803 0 14:45 ? 00:00:00 inet_gethost 4
rabbitmq21864 21863 0 14:45 ? 00:00:00 inet_gethost 4
root 2199716405 0 14:45 pts/1 00:00:00 grep rabbitmq
5) 添加管理账户
[root@localhostrabbitmq-server-3.6.12]# rabbitmqctl status
Status ofnode rabbit@localhost
[{pid,21697},
{running_applications,
[{rabbitmq_management,"RabbitMQManagement Console","3.6.12"},
{rabbitmq_management_agent,"RabbitMQManagement Agent",
{rabbitmq_web_dispatch,"RabbitMQ WebDispatcher",
{cowboy,"Small,fast,modular HTTPserver.","1.0.4"},
{amqp_client,"RabbitMQ AMQPClient",
{inets,"INETS CXC 138 49","6.4"},
{cowlib,"Support library formanipulating Web protocols.","1.0.2"},
{rabbit,"RabbitMQ",
{mnesia,"MNESIA CXC 138 12","4.15"},
{ranch,"Socket acceptor pool for TCPprotocols.","1.3.0"},
{ssl,"Erlang/OTP SSLapplication","8.2"},
{public_key,"Public keyinfrastructure","1.4.1"},
{asn1,"The Erlang ASN1 compilerversion 5.0","5.0"},
{rabbit_common,
"Modules shared byrabbitmq-server and rabbitmq-erlang-client",
"3.6.12"},
{xmerl,"XMLparser","1.3.15"},
{os_mon,"CPO CXC 138 46","2.4.2"},
{Syntax_tools,"Syntaxtools","2.1.2"},
{crypto,"CRYPTO","4.0"},
{compiler,"ERTS CXC 138 10","7.1"},
{sasl,"SASL CXC 138 11","3.0.4"},
{stdlib,"3.4"},
{kernel,"5.3"}]},
{os,{unix,linux}},
{erlang_version,
"Erlang/OTP 20 [erts-9.0] [source][64-bit] [smp:2:2] [ds:2:2:10] [async-threads:64] [hipe][kernel-poll:true]\n"},
{memory,
[{connection_readers,0},
{connection_writers,
{connection_channels,
{connection_other,2840},
{queue_procs,
{queue_slave_procs,
{plugins,747512},
{other_proc,23097880},
{metrics,193816},
{mgmt_db,145296},62032},
{other_ets,1996920},
{binary,327408},
{msg_index,42264},
{code,24781113},
{atom,1041593},
{other_system,23862870},
{total,76304384}]},
{alarms,[]},
{listeners,[{clustering,25672,"::"},{amqp,5672,{http,15672,"::"}]},
{vm_memory_calculation_strategy,RSS},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,3301929779},
{disk_free_limit,50000000},
{disk_free,25591230464},
{file_descriptors,
[{total_limit,924},{total_used,2},{sockets_limit,829},{sockets_used,0}]},
{processes,[{limit,1048576},{used,328}]},
{run_queue,
{uptime,301},
{kernel,{net_ticktime,60}}]
[root@localhostrabbitmq-server-3.6.12]# rabbitmqctl add_user admin admin
Creatinguser "admin"
[root@localhostrabbitmq-server-3.6.12]# rabbitmqctl set_user_tags admin administrator
Settingtags for user "admin" to [administrator]
[root@localhostrabbitmq-server-3.6.12]# rabbitmqctl set_permissions -p "/" admin".*" ".*" ".*"
Settingpermissions for user "admin" in vhost "/"
[root@localhostrabbitmq-server-3.6.12]# rabbitmqctl list_users
Listingusers
admin [administrator]
guest [administrator]
[root@localhostrabbitmq-server-3.6.12]#
6) 通过web界面访问
WEB管理访问地址:http://172.17.2.22:15672/
登录帐号:admin密码:abcd001
7)常用rabbitMq启动命令 service rabbitmq-server start service rabbitmq-server stop service rabbitmq-server status service rabbitmq-server rotate-logs| service rabbitmq-server restart service rabbitmq-server condrestart service rabbitmq-server try-restart service rabbitmq-server reload service rabbitmq-server force-reload ps -ef | grep rabbitmq 查看rabbitMq进程 netstat -anplt | grep LISTEN rabbitmq默认监听端口15672/5672