1、拉取镜像文件:docker pull centos
2、建立容器,且shell方式进入:docker run -it --name centos.rabbit centos /bin/bash
3、安装gcc: yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel
4、安装wget:wget:yum -y install wget
5、安装elang
5.1、下载erlang语言包:
cd /home
wget http://erlang.org/download/otp_src_19.0.tar.gz
5.2、解压:tar xvf otp_src_19.0.tar.gz
5.3、编译安装erlang
cd otp_src_19.0./configure --prefix=/usr/local/erlang --with-ssl -enable-threads -enable-smmp-support -enable-kernel-poll --enable-hipe --without-javacmake && make install
5.4、修改配置
vi /etc/profile
增加以下配置项
ERLANG_HOME=/usr/local/erlang
PATH=$ERLANG_HOME/bin:$PATHexport ERLANG_HOMEexport PATH5.5、配置生效
source /etc/profile
6、安装rabbit
6.1、下载rabbit
cd /home
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.5/rabbitmq-server-generic-unix-3.6.5.tar.xz6.2、解压
tar -xvf rabbitmq-server-generic-unix-3.6.5.tar
6.3、拷贝解压文件目录到/usr/local中
cp -rf ./rabbitmq_server-3.6.5 /usr/local/
6.4、进入 /usr/local
cd /usr/local/6.5、修改rabbitmq的文件夹名称mv rabbitmq_server-3.6.5 rabbitmq-3.6.56.6、进入rabbit的sbin文件夹cd ./rabbitmq-3.6.5/sbin/6.7、打开rabbitmq_management./rabbitmq-plugins enable rabbitmq_management6.8、修改配置rabbitmq-server
vi ./rabbitmq-server在文件头部增加ERLANG_HOME=/usr/local/erlangexportPATH=$ERLANG_HOME/bin:$PATH6.9、修改配置rabbitmqctl
vi ./rabbitmqctl
在文件头部增加ERLANG_HOME=/usr/local/erlangexportPATH=$ERLANG_HOME/bin:$PATH6.10、启动rabbit-server
./rabbitmq-server6.11、./rabbitmq-server -detached6.12、停止rabbit./rabbitmqctl stop6.13、增加用户test
cd /usr/local/rabbitmq-3.6.5/sbin在rabbitmq运行中,执行以下三个命令A、增加test用户且密码为123456
./rabbitmqctl add_user test 123456
B、设置角色./rabbitmqctl set_user_tags test administratorC、设置权限
./rabbitmqctl set_permissions -p "/" test ".*" ".*" ".*"
7、制作镜像文件
docker commit centos.rabbit centos7/rabbitmq365
8、生成容器,容器启动rabbit
docker run --name=rabbitmq5672 -tid -p 5672:5672 -p 15672:15672 centos7/rabbitmq365 /usr/local/rabbitmq-3.6.5/sbin/rabbitmq-server
9、浏览器中输入http://localhost:15672,出现以下界面