rabbitMQ的安装


1.依赖环境的安装


yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC unixODBC-devel httpd python-simplejson



2.语言环境的安装


wget http://erlang.org/download/otp_src_19.2.tar.gz


tar xvf otp_src_19.2.tar.gz


cd otp_src_19.2


  ./configure  --prefix=/usr/local/erlang --enable-smp-support  --enable-threads  --enable-sctp --enable-kernel-poll --enable-hipe  --with-ssl --without-javac


 --prefix  指定安装目录

 

--enable-smp-support启用对称多处理支持(Symmetric Multi-Processing对称多处理结构的简称)


 --enable-threads启用异步线程支持


 --enable-sctp启用流控制协议支持(Stream Control Transmission Protocol,流控制传输协议)


 --enable-kernel-poll启用Linux内核poll


 --enable-hipe启用高性能Erlang  

 --with-ssl 启用ssl包  

 --without-javac 不用java编译

 

  

make && make install 


 测试安装是否成功 /usr/local/erlang/bin/erl


1> EvenN = lists:filter (fun (N) -> N rem 2 == 0 end,lists:seq(1,100)).  输入出现以下内容

[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,

 44,46,48,50,52,54,56,58|...]

2> halt().  退出


 配置环境变量

vim /etc/profile


export PATH=$PATH:/usr/local/erlang/bin


source /etc/profile


3.安装rabbitMQ(rpm 包安装)


rpm -ivh rabbitmq-server-3.6.6-1.el6.noarch.rpm  安装会报错 有依赖关系解决方法不安装依赖关系


——————————————————————————————————————————————————————————————————

warning: rabbitmq-server-3.6.6-1.el6.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 6026dfca: NOKEY

error: Failed dependencies:

erlang >= R16B-03 is needed by rabbitmq-server-3.6.6-1.el6.noarch

socat is needed by rabbitmq-server-3.6.6-1.el6.noarch

————————————————————————————————————————————————————————————————————

解决方法:


 yum -y install socat 


  此时会报错没有socat包或是找不到socat包,解决方法安装centos的epel的扩展源


 yum -y install epel-release  之后执行yum -y install socat 安装socat


接着安装rpm -ivh rabbitmq-server-3.6.6-1.el6.noarch.rpm  安装会报错 有依赖关系解决方法不安装依赖关系


rpm -i --nodeps rabbitmq-server-3.6.6-1.el6.noarch.rpm 


生成配置文件


cp /usr/share/doc/rabbitmq-server-3.6.6/rabbitmq.config.example /etc/rabbitmq/rabbitmq.config


启动rabbitmq


 service rabbitmq-server start 


报错如下:

——————————————————————————————————————————————

Starting rabbitmq-server: rmdir: failed to remove `/var/run/rabbitmq': Directory not empty

FAILED - check /var/log/rabbitmq/startup_{log, _err}

rabbitmq-server.

————————————————————————————————————————————————————


解决方法:


ln -s /usr/local/erlang/bin/erl /usr/bin/erl


之后再次启动正常


     service rabbitmq-server   start|stop|status|rotate-logs|restart|condrestart|try-restart|reload|force-reload


service rabbitmq-server start


netstat -anplt | grep LISTEN  默认监听端口15672/5672


开启管理页面插件


rabbitmq-plugins enable rabbitmq_management


 添加管理员账号


    rabbitmqctl add_user rabbitadmin 123456


   分配用户标签


   rabbitmqctl set_user_tags rabbitadmin administrator 


   创建和赋角色完成后查看并确认

 

  rabbitmqctl list_users 

 

登录管理界面


 浏览器输入地址:http://服务器IP地址:15672/  


  用户名密码:rabbitadmin/123456