CentOS6264bit install erlang and RabbitMQServer1, operating system environment (CentOS62
CentOS 6.2 64bit install erlang and RabbitMQ Server
1. operating system environment (CentOS 6.2 64bit)
[root@leekwen ~]# cat /etc/issueCentOS release 6.2 (Final)Kernel \r on an \m[root@leekwen ~]# cat /proc/cpuinfo |grep "clflush size"clflush size : 64clflush size : 64clflush size : 64clflush size : 64clflush size : 64clflush size : 64clflush size : 64clflush size : 64
2. install the basic environment on which erlang depends
[root@leekwen ~]# yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel
3. import the erlang source and install erlang
[root@leekwen ~]# rpm --import http://binaries.erlang-solutions.com/debian/erlang_solutions.asc[root@leekwen ~]# wget -O /etc/yum.repos.d/erlang_solutions.repo http://binaries.erlang-solutions.com/rpm/centos/erlang_solutions.repo--2014-04-09 22:29:49-- http://binaries.erlang-solutions.com/rpm/centos/erlang_solutions.repoResolving binaries.erlang-solutions.com... 46.235.224.136Connecting to binaries.erlang-solutions.com|46.235.224.136|:80... connected.HTTP request sent, awaiting response... 301 Moved PermanentlyLocation: http://packages.erlang-solutions.com//rpm/centos/erlang_solutions.repo [following]--2014-04-09 22:29:56-- http://packages.erlang-solutions.com//rpm/centos/erlang_solutions.repoResolving packages.erlang-solutions.com... 31.172.186.53Connecting to packages.erlang-solutions.com|31.172.186.53|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 245Saving to: /etc/yum.repos.d/erlang_solutions.repo100%[=================================================================================>] 245 --.-K/s in 0s2014-04-09 22:30:09 (34.0 MB/s) - /etc/yum.repos.d/erlang_solutions.repo[root@leekwen ~]# wget http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpmResolving tree.repoforge.org... 78.46.17.228Connecting to tree.repoforge.org|78.46.17.228|:80... connected.HTTP request sent, awaiting response... 301 Moved PermanentlyLocation: http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm [following]--2014-04-09 22:30:54-- http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpmResolving apt.sw.be... 193.1.193.67Connecting to apt.sw.be|193.1.193.67|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 12700 (12K) [application/x-redhat-package-manager]Saving to: rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm100%[=================================================================================>] 12,700 4.80K/s in 2.6s2014-04-09 22:31:07 (4.80 KB/s) - rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm[root@leekwen ~]# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt[root@leekwen ~]# rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm[root@leekwen ~]# yum update[root@leekwen ~]# yum update --skip-broken[root@leekwen ~]# yum install erlang
4. test the erlang environment
[root@leekwen ~]# erlErlang R16B03 (erts-5.10.4) [source] [64-bit] [smp:8:8] [async-threads:10] [kernel-poll:false]Eshell V5.10.4 (abort with ^G)1> A=12.122> A.123>BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution^C[root@leekwen ~]#
5. download and install rabbitmq-server
[root@leekwen ~]# wget -c http://www.rabbitmq.com/releases/rabbitmq-server/v3.3.0/rabbitmq-server-3.3.0-1.noarch.rpm--2014-04-10 16:44:24-- http://www.rabbitmq.com/releases/rabbitmq-server/v3.3.0/rabbitmq-server-3.3.0-1.noarch.rpmResolving www.rabbitmq.com... 192.240.153.117Connecting to www.rabbitmq.com|192.240.153.117|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 3869384 (3.7M) [application/x-redhat-package-manager]Saving to: “rabbitmq-server-3.3.0-1.noarch.rpm”100%[======================================>] 3,869,384 11.9K/s in 5m 37s2014-04-10 16:50:10 (11.2 KB/s) - “rabbitmq-server-3.3.0-1.noarch.rpm” saved [3869384/3869384][root@leekwen ~]# yum install rabbitmq-server-3.3.0-1.noarch.rpmLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfile * base: centos.ustc.edu.cn * extras: centos.ustc.edu.cn * rpmforge: ftp.riken.jp * updates: centos.ustc.edu.cnSetting up Install ProcessExamining rabbitmq-server-3.3.0-1.noarch.rpm: rabbitmq-server-3.3.0-1.noarchMarking rabbitmq-server-3.3.0-1.noarch.rpm to be installedResolving Dependencies--> Running transaction check---> Package rabbitmq-server.noarch 0:3.3.0-1 will be installed--> Finished Dependency ResolutionDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Installing: rabbitmq-server noarch 3.3.0-1 /rabbitmq-server-3.3.0-1.noarch 4.3 MTransaction Summary================================================================================Install 1 Package(s)Total size: 4.3 MInstalled size: 4.3 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Installing : rabbitmq-server-3.3.0-1.noarch 1/1Installed: rabbitmq-server.noarch 0:3.3.0-1Complete!
6. start rabbitmq-server
[root@leekwen ~]# /etc/init.d/rabbitmq-server startStarting rabbitmq-server:FAILED - check /var/log/rabbitmq/startup_{log, _err}rabbitmq-server.[root@leekwen ~]# cat /var/log/rabbitmq/startup_err[root@leekwen ~]# cat /var/log/rabbitmq/startup_logERROR: epmd error for host leekwen: address (cannot connect to host/port)[root@leekwen ~]# hostnameleekwen[root@leekwen ~]# vi /etc/sysconfig/networkNETWORKING=yesHOSTNAME=leekwen[root@leekwen ~]# cat /etc/hosts127.0.0.1 localhost127.0.0.1 leekwen::1 localhost
7. the above operations eliminate the error of RabbitMQ-Server startup due to different host names. modify the host name (refer to the above steps) and start RabbitMQ-Server again.
[root@leekwen ~]# /etc/init.d/rabbitmq-server restartRestarting rabbitmq-server: RabbitMQ is not runningFAILED - check /var/log/rabbitmq/startup_{log, _err}rabbitmq-server.
8. if the same result is returned, view the error log:
[root@leekwen ~]# cat /var/log/rabbitmq/startup_log RabbitMQ 3.3.0. Copyright (C) 2007-2013 GoPivotal, Inc. ## ## Licensed under the MPL. See http://www.rabbitmq.com/ ## ## ########## Logs: /var/log/rabbitmq/rabbit@leekwen.log ###### ## /var/log/rabbitmq/rabbit@leekwen-sasl.log ########## Starting broker...BOOT FAILED===========Error description: {case_clause, {error, {{shutdown, {failed_to_start_child,tcp_listener, {cannot_listen,{0,0,0,0,0,0,0,0},5672,eaddrinuse}}}, {child,undefined,'rabbit_tcp_listener_sup_:::5672', {tcp_listener_sup,start_link, [{0,0,0,0,0,0,0,0}, 5672, [inet6,binary, {packet,raw}, {reuseaddr,true}, {backlog,128}, {nodelay,true}, {linger,{true,0}}, {exit_on_close,false}], {rabbit_networking,tcp_listener_started,[amqp]}, {rabbit_networking,tcp_listener_stopped,[amqp]}, {rabbit_networking,start_client,[]}, "TCP Listener"]}, transient,infinity,supervisor, [tcp_listener_sup]}}}}Log files (may contain more information): /var/log/rabbitmq/rabbit@leekwen.log /var/log/rabbitmq/rabbit@leekwen-sasl.logStack trace: [{rabbit_networking,start_listener0,4,[]}, {rabbit_networking,'-start_listener/4-lc$^0/1-0-',4,[]}, {rabbit_networking,start_listener,4,[]}, {rabbit_networking,'-boot_tcp/0-lc$^0/1-0-',1,[]}, {rabbit_networking,boot_tcp,0,[]}, {rabbit_networking,boot,0,[]}, {rabbit,'-run_boot_step/1-lc$^1/1-1-',1,[]}, {rabbit,run_boot_step,1,[]}]BOOT FAILED===========Error description: {could_not_start,rabbit, {bad_return, {{rabbit,start,[normal,[]]}, {'EXIT', {rabbit,failure_during_boot, {case_clause, {error, {{shutdown, {failed_to_start_child,tcp_listener, {cannot_listen,{0,0,0,0,0,0,0,0},5672,eaddrinuse}}}, {child,undefined,'rabbit_tcp_listener_sup_:::5672', {tcp_listener_sup,start_link, [{0,0,0,0,0,0,0,0}, 5672, [inet6,binary, {packet,raw}, {reuseaddr,true}, {backlog,128}, {nodelay,true}, {linger,{true,0}}, {exit_on_close,false}], {rabbit_networking,tcp_listener_started,[amqp]}, {rabbit_networking,tcp_listener_stopped,[amqp]}, {rabbit_networking,start_client,[]}, "TCP Listener"]}, transient,infinity,supervisor, [tcp_listener_sup]}}}}}}}}}Log files (may contain more information): /var/log/rabbitmq/rabbit@leekwen.log /var/log/rabbitmq/rabbit@leekwen-sasl.log{"init terminating in do_boot",{rabbit,failure_during_boot,{could_not_start,rabb use,{error,{{shutdown,{failed_to_start_child,tcp_listener,{cannot_listen,{0,0,0, stener_sup,start_link,[{0,0,0,0,0,0,0,0},5672,[inet6,binary,{packet,raw},{reusea networking,tcp_listener_started,[amqp]},{rabbit_networking,tcp_listener_stopped, or,[tcp_listener_sup]}}}}}}}}}}}tail: /var/log/rabbitmq/startup_log: file truncated [FAILED][root@leekwen ~]# cat /var/log/rabbitmq/startup_errCrash dump was written to: erl_crash.dumpinit terminating in do_boot ()
9. the above error may occur because Port 5672 is occupied.
Check Port 5672. if a process occupies this port, disable it and restart RabbitMQ-Server;
[root@leekwen ~]# netstat -atn |grep 5672tcp 0 0 0.0.0.0:5672 0.0.0.0:* LISTEN[root@leekwen ~]# lsof -i:5672COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEqpidd 1901 qpidd 10u IPv4 13941 0t0 TCP *:amqp (LISTEN)[root@leekwen ~]# chkconfig qpidd off[root@leekwen ~]# netstat -atn |grep 5672tcp 0 0 0.0.0.0:5672 0.0.0.0:* LISTEN[root@leekwen ~]# chkconfig qpidd --listqpidd 0:off 1:off 2:off 3:off 4:off 5:off 6:off[root@leekwen ~]# /etc/init.d/qpidd stopStopping Qpid AMQP daemon: [ OK ][root@leekwen ~]# netstat -atn |grep 5672tcp 0 0 127.0.0.1:25672 127.0.0.1:60925 TIME_WAIT[root@leekwen ~]# lsof -i:5672[root@leekwen ~]# /etc/init.d/rabbitmq-server startStarting rabbitmq-server: SUCCESSrabbitmq-server.
10. check the startup status of the RabbitMQ service and enable the corresponding management plug-in of RabbitMQ:
[Root @ leekwen ~] # Rabbitmqctl statusStatus of node rabbit @ leekwen... [{pid, 716}, {running_applications, [{rabbit, "RabbitMQ", "3.3.0" },{ OS _mon, "CPO CXC 138 46", "2.2.14 "}, {mnesia, "mnesia cxc 138 12", "4.11" },{ xmerl, "XML parser", "1.3.5" },{ sasl, "sasl cxc 138 11 ", "2.3.4" },{ stdlib, "erts cxc 138 10", "1.19.4" },{ kernel, "erts cxc 138 10", "2.16.4"}] },{ OS, {unix, linux },{ erlang_version, "Erlang R16B03 (erts-5.10.4) [source] [64-bit] [smp: 8: 8] [async-threads: 30] [kernel-poll: true] \ n "}, {memory, [{total, 36436456 },{ connection_procs, 2704 },{ queue_procs, 5408 },{ plugins, 0 },{ other_proc, 13704576 },{ mnesia, 60240 },{ mgmt_db, 0 }, {msg_index, 24368 },{ other_ets, 789624 },{ binary, 13672 },{ code, 16399491 },{ atom, 594537 },{ other_system, 4841836}]}, {alarms, [] },{ listeners, [{clustering, 25672, ":" },{ amqp, 5672, "::"}] },{ vm_memory_high_w Atermark, 0.4 },{ vm_memory_limit, 6690450636 },{ disk_free_limit, 50000000 },{ disk_free, 47402364928 },{ file_descriptors, [{total_limit, 924 },{ total_used, 3 }, {sockets_limit, 829 },{ sockets_used, 1}] },{ processes, [{limit, 1048576 },{ used, 131}] },{ run_queue, 0 }, {uptime, 83}]... done. [root @ leekwen ~] # Netstat-atn | grep 5672tcp 0 0 0.0.0.0: 25672 0.0.0.0: * LISTENtcp 0 0 ::: 5672 ::* LISTEN [root @ leekwen ~] # Lsof-I: 5672 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEbeam. smp 716 rabbitmq 15u IPv6 1948888 0t0 TCP *: amqp (LISTEN) [root @ leekwen ~] # Rabbitmq-plugins list [] amqp_client 3.3.0 [] cowboy 0.5.0-rmq3.3.0-git4b93c2d [] eldap 3.3.0-example [] mochiweb 2.7.0-rmq3.3.0-example [] release 3.3.0 [] release 3.3.0 [] rabbitmq_auth_mechanic ism_ssl 3.3.0 [] rabbitmq_consistent_hash_exchange 3.3.0 [] rabbitmq_federation 3.3.0 [] rabbitmq_federation_management 3.3.0 [] rabbitmq_management 3.3.0 [] rabbitmq_mana Gement_agent 3.3.0 [] rule 3.3.0 [] rabbitmq_mqtt 3.3.0 [] rule 3.3.0 [] rule 3.3.0 [] rabbitmq_stomp 3.3.0 [] rabbitmq_tracing 3.3.0 [] rule 3.3.0 [] rule 3.3.0 [] rule 3.3.0 [] sockjs 0.3.4-rmq3.3.0-git3132eb9 [] webmachine 1.10.3-rmq3.3.0-gite9359c7 [root @ leekwen ~] # Rabbitmq-plugins enable rabbitmq_managementThe following plugins have been enabled: mochiweb webmachine implements amqp_client without configuring has changed. Restart RabbitMQ for changes to take effect. [root @ leekwen ~] # Rabbitmq-plugins enable mochiweb webmachine rabbitmq_web_dispatch amqp_client rabbitmq_m anagement_agent rabbitmq_managementPlugin configuration unchanged. [root @ leekwen ~] # Rabbitmq-plugins list [E] amqp_client 3.3.0 [] cowboy 0.5.0-rmq3.3.0-git4b93c2d [] eldap 3.3.0-example [E] mochiweb 2.7.0-rmq3.3.0-example [] example 3.3.0 [] Example 3.3.0 [] rabbitmq_auth_mechanic ism_ssl 3.3.0 [] Protocol 3.3.0 [] rabbitmq_federation 3.3.0 [] rabbitmq_federation_management 3.3.0 [E] rabbitmq_management 3.3.0 [E] rabbitmq_mana Gement_agent 3.3.0 [] rule 3.3.0 [] rabbitmq_mqtt 3.3.0 [] rule 3.3.0 [] rule 3.3.0 [] rabbitmq_stomp 3.3.0 [] rabbitmq_tracing 3.3.0 [E] rule 3.3.0 [] rule 3.3.0 [] rule 3.3.0 [] sockjs 0.3.4-rmq3.3.0-git3132eb9 [E] webmachine 1.10.3-rmq3.3.0-gite9359c7 [root @ leekwen ~] # Rabbitmq-plugins list [E] amqp_client 3.3.0 [] cowboy 0.5.0-rmq3.3.0-git4b93c2d [] eldap 3.3.0-example [E] mochiweb 2.7.0-rmq3.3.0-example [] example 3.3.0 [] Example 3.3.0 [] rabbitmq_auth_mechanic ism_ssl 3.3.0 [] Protocol 3.3.0 [] rabbitmq_federation 3.3.0 [] rabbitmq_federation_management 3.3.0 [E] rabbitmq_management 3.3.0 [E] rabbitmq_mana Gement_agent 3.3.0 [] rule 3.3.0 [] rabbitmq_mqtt 3.3.0 [] rule 3.3.0 [] rule 3.3.0 [] rabbitmq_stomp 3.3.0 [] rabbitmq_tracing 3.3.0 [E] rule 3.3.0 [] rule 3.3.0 [] rule 3.3.0 [] sockjs 0.3.4-rmq3.3.0-git3132eb9 [E] webmachine 1.10.3-rmq3.3.0-gite9359c7 [root @ leekwen ~] # Netstat-atn | grep 5672tcp 0 0 0.0.0.0: 25672 0.0.0.0: * LISTENtcp 0 0 ::: 5672 ::* LISTEN [root @ leekwen ~] # Netstat-atn | grep 15672 [root @ leekwen ~] # Netstat-atn | grep 55672 [root @ leekwen ~] #/Etc/init. d/rabbitmq-server restartRestarting rabbitmq-server: SUCCESSrabbitmq-server. [root @ leekwen ~] # Netstat-atn | grep 55672 [root @ leekwen ~] # Netstat-atn | grep 5672tcp 0 0 0.0.0.0: 15672 0.0.0.0: * LISTENtcp 0 0 0.0.0.0: 25672 0.0.0.0: * LISTENtcp 0 0 127.0.0.1: 54463 127.0.0.1: 25672 TIME_WAITtcp 0 0 127.0.0.1: 60321 127.0.0.1: 25672 TIME_WAITtcp 0 0 127.0.0.1: 25672 127.0.0.1: 56750 TIME_WAITtcp 0 0 ::: 5672 ::* LISTEN can be used to log on to guest http://192.168.1.101:15672 Port.
Note: If you cannot log on from Port 15672 or 55672, disable the firewall of CentOS6.2 and log on again,
If you still cannot log on, view the log and display:
=ERROR REPORT==== 20-Apr-2014::00:55:15 ===webmachine error: path="api/whoami""Unauthorized"
Run the following command to add the user admin and password admin.
[root@leekwen ~]# rabbitmqctl add_user admin adminCreating user "admin" ......done.[root@leekwen ~]# rabbitmqctl list_usersListing users ...admin []guest [administrator]...done.[root@leekwen ~]# rabbitmqctl set_user_tags admin administratorSetting tags for user "admin" to [administrator] ......done.[root@leekwen ~]# rabbitmqctl list_usersListing users ...admin [administrator]guest [administrator]...done.
At this point, the configuration is complete.