linux安装rabbitmq教程,简单有用
答:
1.RabbitMQ依赖Erlang, 所以需要先安装Erlang
逐步执行以下命令:
wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
如果出现:epel-release is needed by erlang-solutions-1.0-1.noarch
就执行:yum install epel-release
然后再执行一次:sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
sudo yum install erlang
如果报404错改成以下命令执行:
sudo yum install erlang --disablerepo=erlang-solutions
2.验证erlang是否安装成功
erl
ssl:versions().
halt().
以下结果说明安装erlang正常:
[root@VM_0_4_centos rabbitmq]# erl
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V5.10.4 (abort with ^G)
1> ssl:versions().
[{ssl_app,"5.3.3"},
{supported,['tlsv1.2','tlsv1.1',tlsv1]},
{available,['tlsv1.2','tlsv1.1',tlsv1]}]
2> halt().
3.安装RabbitMQ
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm
yum install rabbitmq-server-3.6.6-1.el7.noarch.rpm
安装时如果遇到下面的依赖错误就先执行sudo yum install socat:
Error: Package: socat-1.7.2.3-1.el6.x86_64 (epel)
Requires: libreadline.so.5()(64bit)
sudo chkconfig rabbitmq-server on # 添加开机启动RabbitMQ服务
sudo /sbin/service rabbitmq-server start # 启动服务
sudo /sbin/service rabbitmq-server status # 查看服务状态
sudo /sbin/service rabbitmq-server stop # 停止服务
4.启动rabbitmq服务后,执行以下命令开启浏览器管理页面,访问地址:http://ip:15672:
sudo rabbitmq-plugins enable rabbitmq_management
如果guest远程登录失败,就在/etc/rabbitmq/目录新建一个rabbitmq.config文件,添加:[{rabbit, [{loopback_users, []}]}]. (别忘了最后的点)重启服务即可。
如果要修改guest密码,linux执行以下命令即可:
rabbitmqctl change_password guest 'guest1190'