centos7 安装rabbitmq
1. yum install rabbitmq-server-3.6.10-1.el6.noarch.rpm
2. 启动
[root@izuf6d5mlh03qbmxtdk5zxz src]# service rabbitmq-server start Starting rabbitmq-server (via systemctl): Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details. [FAILED]
查看:
cat /var/log/rabbitmq/startup_log
{error_logger,{{2018,9,19},{15,35,29}},"Error when reading /var/lib/rabbitmq/.erlang.cookie: eacces",[]} {error_logger,{{2018,9,19},{15,35,29}},crash_report,[[{initial_call,{auth,init,['Argument__1']}},{pid,<0.20.0>},{registered_name,[]},{error_info,{exit,{"Error when reading /var/lib/rabbitmq/.erlang.cookie: eacces"
解决:
chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
二。源码安装
1. 下载:http://erlang.org/download/otp_src_21.2.tar.gz
tar -xvf otp_src_21.0.tar.gz
报错:configure: error: No curses library functions found
解决:yum install -y ncurses-devel
./configure --prefix=/usr/local/erlang
make && make install
2.下载rabbitmq
https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.9/rabbitmq-server-generic-unix-3.7.9.tar.xz
xz -d rabbitmq-server-generic-unix-3.7.7.tar.xz tar -xvf rabbitmq-server-generic-unix-3.7.7.tar mv rabbitmq_server-3.7.7/ /usr/local/rabbitmq
3. 配置
#打开环境变量文件 vim /etc/profile #添加erlang rabbitmq 到环境变量 export PATH=$PATH:/usr/local/erlang/bin export PATH=$PATH:/usr/local/rabbitmq/sbin #重新加载环境变量 source /etc/profile
安装: rabbitmq-plugins enable rabbitmq_management
报错: Error: {error,{missing_dependencies,[crypto,ssl], [amqp10_client,cowboy,cowlib,rabbitmq_aws, rabbitmq_management,rabbitmq_management_agent, rabbitmq_shovel,rabbitmq_trust_store]}} Stacktrace [{rabbit_plugins,ensure_dependencies,1, [{file,"src/rabbit_plugins.erl"},{line,272}]}, {'Elixir.RabbitMQ.CLI.Plugins.Helpers',list,1, [{file,"lib/rabbitmq/cli/plugins/plugins_helpers.ex"}, {line,49}]}, {'Elixir.RabbitMQ.CLI.Plugins.Helpers',validate_plugins,2, [{file,"lib/rabbitmq/cli/plugins/plugins_helpers.ex"}, {line,121}]}, {'Elixir.RabbitMQ.CLI.Plugins.Commands.EnableCommand',run,2, [{file,"lib/rabbitmq/cli/plugins/commands/enable_command.ex"}, {line,74}]}, {'Elixir.RabbitMQCtl',maybe_run_command,3, [{file,"lib/rabbitmqctl.ex"},{line,106}]}, {'Elixir.RabbitMQCtl','-exec_command/2-fun-0-',5, [{file,"lib/rabbitmqctl.ex"},{line,73}]}, {'Elixir.RabbitMQCtl',main,1, [{file,"lib/rabbitmqctl.ex"},{line,36}]}, {'Elixir.Kernel.CLI','-exec_fun/2-fun-0-',3, [{file,"lib/kernel/cli.ex"},{line,105}]}]
解决:yum install erlang-ssl
报错:
=ERROR REPORT==== 26-Dec-2018::19:10:44 === Loading of /usr/local/rabbitmq/escript/rabbitmq-plugins/elixir.beam failed: badfile Failed to start Elixir. error: {error, {elixir, {bad_return, {{elixir,start,[normal,[]]}, {'EXIT', {undef, [{elixir,start,[normal,[]],[]}, {application_master,start_it_old,4, [{file,"application_master.erl"}, {line,269}]}]}}}}}}
参考资料:https://blog.csdn.net/sinat_28156831/article/details/81736764
三. 官方推荐安装方式
在vim /etc/yum.repos.d/rabbitmq-erlang.repo 文件里;参考https://github.com/rabbitmq/erlang-rpm
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
2.rabbitmq 安装