centos 安装rabbitMQ

环境:阿里云 centos 6
1、打开SecureCRTPortable连接工具,使用root账号登录,创建linux系统的新用户,以后所有的操作都在新创建的用户上操作,避免使用root用户(root权限太大,容易误操作)
2、命令行的命令:

[root@iZ112fail84Z ~]$ useradd lulei  --创建新用户
[lulei@iZ112fail84Z ~]$ passwd lulei --给新用户设置密码
[lulei@iZ112fail84Z ~]$ su - lulei 切换到新用户
[lulei@iZ112fail84Z /]$ yum install gcc gcc-c++
Loaded plugins: security
You need to be root to perform this command.
提示需要root用户权限才可以安装,切换到root
[lulei@iZ112fail84Z /]$ su root
Password:
[root@iZ112fail84Z /]# whoami
root
[root@iZ112fail84Z /]# yum install gcc gcc-c++
.....
Total download size: 26 M
Is this ok [y/N]: y
Dependency Updated:
  cpp.x86_64 0:4.4.7-17.el6                           gcc-gfortran.x86_64 0:4.4.7-17.el6              
  libgcc.x86_64 0:4.4.7-17.el6                        libgfortran.x86_64 0:4.4.7-17.el6               
  libgomp.x86_64 0:4.4.7-17.el6                       libstdc++.x86_64 0:4.4.7-17.el6                 
  libstdc++-devel.x86_64 0:4.4.7-17.el6              

Complete!
[root@iZ112fail84Z /]# yum install python
Dependency Updated:
  python-libs.x86_64 0:2.6.6-66.el6_8                                                                  

Complete!
[root@iZ112fail84Z /]# yum install erlang
Complete!
依赖包xmlto
[root@iZ112fail84Z /]# yum install xmlto
Complete!
[root@iZ112fail84Z opt]# mkdir /opt/modules  # 用于软件安装目录
[root@iZ112fail84Z opt]# mkdir /opt/softwares # 用于软件下载目录

设置这2个目录的用户和组都为lulei
[root@iZ112fail84Z opt]# chown lulei:lulei /opt/modules
[root@iZ112fail84Z opt]# chown lulei:lulei /opt/softwares
[root@iZ112fail84Z opt]# ll
total 12
drwxr-xr-x  2 lulei lulei 4096 Dec 17 21:36 modules
drwxr-xr-x  2 lulei lulei 4096 Dec 17 21:36 softwares

[root@iZ112fail84Z /]# su  lulei --切换回普通用户

rabbit MQ官方网站:http://www.rabbitmq.com/download.html

[lulei@iZ112fail84Z /]$ cd /opt/softwares/
[lulei@iZ112fail84Z softwares]$ wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.6/rabbitmq-server-3.5.6.tar.gz

下载时有可能因为网络原因下载不到rabbitmq-server-3.5.6.tar.gz,可以到这个地方:
http://download.csdn.net/download/fanjeff/9241133下载到本地,然后上传到服务器上。
[lulei@iZ112fail84Z softwares]$ ls
rabbitmq-server-3.5.6.tar.gz

tar xvf rabbitmq-server-3.5.6.tar.gz
解压后
[lulei@iZ112fail84Z softwares]$ ls
rabbitmq-server-3.5.6 rabbitmq-server-3.5.6.tar.gz

 [lulei@iZ112fail84Z softwares]$cd rabbitmq-server-3.5.6
  [lulei@iZ112fail84Z softwares]make --编译
make[2]: Leaving directory `/opt/softwares/rabbitmq-server-3.5.6/plugins-src'
make[1]: Leaving directory `/opt/softwares/rabbitmq-server-3.5.6/plugins-src'
echo "Put your EZs here and use rabbitmq-plugins to enable them." > plugins/README
rm -f plugins/rabbit_common*.ez
[lulei@iZ112fail84Z softwares] mkdir rabbitmq
[lulei@iZ112fail84Z rabbitmq-server-3.5.6]# cd /opt/softwares/rabbitmq/
[lulei@iZ112fail84Z rabbitmq]# ls
[lulei@iZ112fail84Z rabbitmq]# mkdir man
[lulei@iZ112fail84Z rabbitmq]# cd ../rabbitmq-server-3.5.6
[lulei@iZ112fail84Z rabbitmq-server-3.5.6]$ make install TARGET_DIR=/opt/softwares/rabbitmq SBIN_DIR=/opt/softwares/rabbitmq/sbin MAN_DIR=/opt/softwares/rabbitmq/man
[lulei@iZ112fail84Z scripts]$ mkdir /etc/rabbitmq
mkdir: cannot create directory `/etc/rabbitmq': Permission denied
[lulei@iZ112fail84Z rabbitmq-server-3.5.6]$ cd scripts/
[lulei@iZ112fail84Z scripts]$ ls
rabbitmqctl        rabbitmq-defaults.bat  rabbitmq-env.bat      rabbitmq-server
rabbitmqctl.bat    rabbitmq-echopid.bat   rabbitmq-plugins      rabbitmq-server.bat
rabbitmq-defaults  rabbitmq-env           rabbitmq-plugins.bat  rabbitmq-service.bat
[lulei@iZ112fail84Z softwares] cd /opt/softwares/rabbitmq/sbin
[lulei@iZ112fail84Z sbin]$ su root
Password: 
--启动服务
[root@iZ112fail84Z sbin]#./rabbitmq-server start &

              RabbitMQ 3.5.6. Copyright (C) 2007-2015 Pivotal Software, Inc.
  ##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
  ##  ##
  ##########  Logs: /var/log/rabbitmq/rabbit@iZ112fail84Z.log
  ######  ##        /var/log/rabbitmq/rabbit@iZ112fail84Z-sasl.log
  ##########
              Starting broker... completed with 0 plugins.
  [root@iZ112fail84Z sbin]# ./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@izwz95v28cpic4beuk0rk0z... started 6 plugins.

注意:如果是阿里云服务器,必须在安全组规则中添加开启5672和15672这2个端口
访问:
http://.196.190.:15672/ 会出现登录界面

rabbitmq的web管理界面无法使用guest用户登录:
3.3版本后使用guest账号已经不能登录了,解决方法:

新增用户
[root@iZ112fail84Z sbin]# ./rabbitmqctl  add_user  lulei 123456
Creating user "lulei" ...
查看用户列表
[root@iZ112fail84Z sbin]# rabbitmqctl  list_users
bash: rabbitmqctl: command not found
[root@iZ112fail84Z sbin]# ./rabbitmqctl  list_users
Listing users ...
guest   [administrator]
lulei   []
设置用户角色为管理员
[root@iZ112fail84Z sbin]# ./rabbitmqctl set_user_tags lulei administrator
Setting tags for user "lulei" to [administrator] ...

然后使用这个用户重新登录即可登录成功。到此安装全部结束,有问题留言。

posted @ 2016-12-17 22:42  陆陆通通  阅读(125)  评论(0编辑  收藏  举报