安装rabbitmq的文章和帖子多如牛毛,不管是官网还是各个博客,这里附个Rabbitmq官网安装Rpm包的链接, http://www.rabbitmq.com/install-rpm.html
不多说,直接上步骤.
首先下载rpm包, $ wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.1/rabbitmq-server-3.5.1-1.noarch.rpm
安装RabbitMQ
rpm -ivh rabbitmq-server-3.5.1-1.noarch.rpm(这种方式会提示版本需大于R13),加上 -nodeps 就ok了.
或
rpm -ivh --nodeps --force rabbitmq-server-3.5.1-1.noarch.rpm
这时,幺蛾子就来了,
warning: rabbitmq-server-3.5.1-1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 056e8e56: NOKEY
Preparing... ########################################### [100%]
groupadd: cannot open /etc/group
useradd: group 'rabbitmq' does not exist
error: %pre(rabbitmq-server-3.5.1-1.noarch) scriptlet failed, exit status 6
error: install: %pre scriptlet failed (2), skipping rabbitmq-server-3.5.1-1
查阅相关文档,解决如下
用lsattr命令查看/etc/group的隐藏权限设定情况发现如下:
- #lsattr /etc/group
- ----i--------e- /etc/group
i说明设定文件不能被删除、改名、设定链接关系,同时不能写入或新增内容。
用chattr命令对/etc/group去除i权限位:
- #chattr -i /etc/group
- #lsattr /etc/group
- -------------e- /etc/group
再使用groupadd命令时又发现:
- #groupadd rabbitmq
- groupadd: cannot open /etc/gshadow
同样的思想,去除隐式权限i位,再添加组。后面设置如下:
- #chattr -i /etc/gshadow
- #groupadd rabbitmq
- #useradd -g rabbitmq rabbitmq
再去安装: # rpm -ivh --nodeps --force rabbitmq-server-3.5.1-1.noarch.rpm
warning: rabbitmq-server-3.5.1-1.noarch.rpm: Header V4 DSA signature: NOKEY, key ID 056e8e56
Preparing...
########################################### [100%]
1:rabbitmq-server
########################################### [100%]
发现安装成功了。再去查下其rpm包,
#rpm -qa |grep rabbitmq
rabbitmq-server-3.5.1-1.noarch
启动RabbitMQ:
/etc/init.d/rabbitmq-serverstart
或
service rabbitmq-service start
启动rabbitmq服务报错:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
启动mq服务报错,在对应目录下,启动rabbitmq服务,
service rabbitmq-server start
如果启动报错
Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup_{log, _err}
rabbitmq-server.
到相应路径,查看日志文件:
cat /var/log/rabbitmq/startup_log
Activating RabbitMQ plugins ...
ERROR: Could not delete dir /var/lib/rabbitmq/mnesia/rabbit@centhost-plugins-expand ({cannot_delete,
"/var/lib/rabbitmq/mnesia/rabbit@centhost-plugins-expand/rabbitmq_management_agent-2.8.5/ebin/rabbit_mgmt_external_stats.beam",
eacces})
发现没权限删除:
/var/lib/rabbitmq/mnesia/
文件夹下内容,修改了相应权限,重新启动,成功。
检查rabbitmq是否启动
ps aux|grep rabbitmq