# 143. 商品详情页动态渲染系统:部署 RabbitMQ 消息中间件

# 安装编译工具

yum install -y ncurses ncurses-base ncurses-devel ncurses-libs ncurses-static ncurses-term ocaml-curses ocaml-curses-devel
yum install -y openssl-devel zlib-devel
yum install -y make ncurses-devel gcc gcc-c++ unixODBC unixODBC-devel openssl openssl-devel
1
2
3

# 安装依赖 erlang

mkdir /usr/local/erlang
wget http://erlang.org/download/otp_src_20.0.tar.gz
tar -zxvf otp_src_20.0.tar.gz
cd otp_src_20.0
./configure --prefix=/usr/local/erlang --with-ssl -enable-threads -enable-smmp-support -enable-kernel-poll --enable-hipe --without-javac
# 建立软连,软连有啥作用?
ln -s /usr/local/erlang/bin/erl /usr/local/bin/erl

# 配置环境变量
vi ~/.bashrc

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

# 刷新环境变量
source ~/.bashrc

# 尝试使用 erl 看是否正常安装
erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

# 安装 rabbitmq

/usr/local
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.12/rabbitmq-server-generic-unix-3.6.12.tar.xz
# 安装解压 xz 包的工具
yum install -y xz
xz -d rabbitmq-server-generic-unix-3.6.12.tar.xz
tar -xvf rabbitmq-server-generic-unix-3.6.12.tar
mv rabbitmq_server-3.6.12 rabbitmq-3.6.12

# 开启 web 管理页面插件
cd rabbitmq-3.6.12/sbin/
./rabbitmq-plugins enable rabbitmq_management

# 后台启动 rabbitmq server
./rabbitmq-server -detached

# 关闭 rabbitmq server
./rabbitmqctl stop

# 添加管理员账号
./rabbitmqctl add_user admin 123456
./rabbitmqctl set_user_tags admin administrator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

访问地址:http://192.168.99.11:15672/ 进入管理界面