一、安装erlang语言环境
由于rabbitmq是基于erlang语言开发的,因此首先需要安装erlang环境。
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC unixODBC-devel httpd python-simplejson
首先下载erlang安装包解压
wget http://erlang.org/download/otp_src_21.1.tar.gz
tar -xvf otp_src_21.1.tar.gz
mkdir /usr/local/erlang
然后安装erlang, --prefix=/usr/local/erlang为安装目录
cd otp_src_21.1
./configure --prefix=/usr/local/erlang --enable-smp-support --enable-threads --enable-sctp --enable-kernel-poll --enable-hipe --with-ssl --without-javac
erlang语言编译配置选项:
–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
添加环境变量:
vi /etc/profile
export ERLANG_HOME=/usr/local/erlang
export PATH=$PATH:$ERLANG_HOME/bin
source /etc/profile
查看erlang是否安装成功:
erl
Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V10.0 (abort with ^G)
1>
二、下载安装rabbitmq
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.14/rabbitmq-server-generic-unix-3.7.14.tar.xz
xz -d rabbitmq-server-generic-unix-3.7.14.tar.xz
tar -xvf rabbitmq-server-generic-unix-3.7.14.tar
mv rabbitmq-server-generic-unix-3.7.14/ /usr/local/rabbitmq/
vi /etc/profile
export RABBITMQ_HOME=/usr/local/rabbitmq
export PATH=$PATH:$RABBITMQ_HOME/sbin
source /etc/profile
启动rabbitmq:
rabbitmq-server -detached // 启动rabbitmq, -detached表示后台启动
查看rabbitmq运行状态:
rabbitmqctl status
其他命令:
启动服务:rabbitmq-server -detached【 /usr/local/rabbitmq/sbin/rabbitmq-server -detached 】
查看状态:rabbitmqctl status【 /usr/local/rabbitmq/sbin/rabbitmqctl status 】
关闭服务:rabbitmqctl stop【 /usr/local/rabbitmq/sbin/rabbitmqctl stop 】
列出角色:rabbitmqctl list_users