Centos 6.4 安装erlang&rabbitmq的方法


    1. 安装 erlang
    1.1 准备工作,先安装依赖库
    
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel  
yum install ncurses-devel  

    1.2 下载erlang源码
    
wget http://www.erlang.org/download/otp_src_R16B02.tar.gz
cp otp_src_R16B02.tar.gz /usr/src/otp_src_R16B02.tar.gz
cd /usr/src
tar -xzvf otp_src_R16B02.tar.gz  
mv otp_src_R16B02 erlang_R16B

    1.3 编译安装
    
cd erlang_R16B/ 
./configure --prefix=/usr/local/erlang --with-ssl --enable-threads --enable-smp-support --enable-kernel-poll --enable-hipe --without-javac  //不用java编译,故去掉java避免错误  
make && make install //编译后安装  

    1.4 配置环境变量
    
vi /etc/profile  
ERL_HOME=/usr/local/erlang  
export PATH=$PATH:$ERL_HOME/bin  

    2 安装rabbitmq
    2.1 下载
    
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.1.5/rabbitmq-server-3.1.5.tar.gz 
cp rabbitmq-server-3.1.5.tar.gz /usr/src
cd /usr/src
tar -xzvf rabbitmq-server-3.1.5.tar.gz

    2.2 安装依赖库
    
yum -y install xmlto 

    否则会编译不通过:
    
/bin/sh: line 1: xmlto: command not found

    2.3 编译
    
cd rabbitmq-server-3.1.5 
make 
make install TARGET_DIR=/usr/local/rabbitmq SBIN_DIR=/usr/local/rabbitmq/sbin MAN_DIR=/usr/local/rabbitmq/man //将rabbitmq编译到/opt/mq/rabbitmq目录 

    2.4 安装web插件管理界面
    
cd /usr/local/rabbitmq/sbin 
mkdir /etc/rabbitmq/ 
./rabbitmq-plugins enable rabbitmq_management 

    查看插件列表
    
./rabbitmq-plugins list

    2.5 常用命令
    启动rabbitmq
    
./rabbitmq-server -detached

    在浏览器上输入http://127.0.0.1:15672/登录管理界面了
    使用登录的名户名和密码默认都算guest
    关闭rabbitmq
    
./rabbitmqctl stop