在 linux 下安装软件就是折腾,首先是测试机不能上外网要找运维开通,开通后发现测试机的 yum 不能使用于是又要配置 yum 源,最后安装 rabbitmq 时也尝试了两种方法最后才安装成功
机器版本:
[root@redhat1 rabbitmq]# lsb_release
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
[root@redhat1 rabbitmq]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.4 (Santiago)
Release: 6.4
Codename: Santiago
安装的 rabbitmq 版本为 rabbitmq-server-3.4.0-1
安装步骤:
1.RedHat 6.4 替换为 centos 6 的 yum
具体步骤可以参考下面的这篇文章:
http://down.chinaz.com/server/201111/1321_1.htm
不过我使用的 rpm 文件是以下几个(注意是 centos 6的目录,且要根据机器选择是 i386 还是 x86_64):
wget http://centos.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://centos.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
wget http://centos.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://centos.ustc.edu.cn/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
可以在浏览器里面进入目录:
http://centos.ustc.edu.cn/centos/6/os/x86_64/Packages 查看 rpm 文件的版本是否存在
也可以在浏览器里直接下载
在最后执行 yum makecache 时提示:
[root@redhat1 rabbitmq]# yum makecache
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register
这个提示信息可以忽略
虽然提示“not registered to Red Hat”,但 yum 已经可以使用了
2.安装 rabbitmq
根据官网教程(
http://www.rabbitmq.com/install-rpm.html),Redhat 安装 rabbitmq 有三种方法
我尝试了第一种方法“Install Erlang from EPEL ”,没有成功,提示“No package erlang available”
于是尝试第二种方法“Install Erlang from Erlang Solutions”,安装成功:
[root@redhat1 lz]# yum install esl-erlang_17.3-1~centos~6_amd64.rpm
[root@redhat1 lz]# yum install esl-erlang-compat-R14B-1.el6.noarch.rpm
3.启动 rabbitmq
[root@redhat1 lz]# /sbin/service rabbitmq-server start
Starting rabbitmq-server: SUCCESS
rabbitmq-server.
对应的关闭命令为:/sbin/service rabbitmq-server stop
4.查看 rabbitmq 安装目录
[root@redhat1 rabbitmq]# rpm -ql rabbitmq-server-3.4.0-1.noarch
/etc/logrotate.d/rabbitmq-server
/etc/rabbitmq
/etc/rc.d/init.d/rabbitmq-server
/usr/lib/ocf/resource.d/rabbitmq/rabbitmq-server
/usr/lib/rabbitmq/bin/rabbitmq-defaults
/usr/lib/rabbitmq/bin/rabbitmq-env
/usr/lib/rabbitmq/bin/rabbitmq-plugins
/usr/lib/rabbitmq/bin/rabbitmq-server
/usr/lib/rabbitmq/bin/rabbitmqctl
/usr/lib/rabbitmq/lib/rabbitmq_server-3.4.0/LICENSE-APACHE2-ExplorerCanvas
/usr/lib/rabbitmq/lib/rabbitmq_server-3.4.0/LICENSE-APL2-Stomp-We
(省略)
5.开启 rabbitmq 的页面管理功能
[root@redhat1 rabbitmq]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
mochiweb
webmachine
rabbitmq_web_dispatch
amqp_client
rabbitmq_management_agent
rabbitmq_management
Applying plugin configuration to rabbit@redhat1... started 6 plugins.
随后在浏览器里访问:
http://10.75.10.66:15672
输入用户名密码 guest/guest 发现不能登录
原来从 rabbitmq 3.3.0 之后不能以 guest/guest 登录了(本机可以)
要新增用户及权限:
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
创建了用户名/密码:test/test
最后成功登录