RabbitMQ安装

这里,简单介绍将 网市场云建站系统 分布式部署之 RabbitMQ 消息中间件 安装在Linux系统的步骤 ## 系统 CentOS 7.4 , 64位 ## CentOS环境安装 服务器上安装命令: ```` # 创建存放下载文件的文件夹 /readyFile mkdir /readyFile cd /readyFile # 安装依赖 yum install -y gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git # 安装 erlang touch /etc/yum.repos.d/rabbitmq-erlang.repo echo '[rabbitmq-erlang]'>>/etc/yum.repos.d/rabbitmq-erlang.repo echo 'name=rabbitmq-erlang'>>/etc/yum.repos.d/rabbitmq-erlang.repo echo 'baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7'>>/etc/yum.repos.d/rabbitmq-erlang.repo echo 'gpgcheck=1'>>/etc/yum.repos.d/rabbitmq-erlang.repo echo 'gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc'>>/etc/yum.repos.d/rabbitmq-erlang.repo echo 'repo_gpgcheck=0'>>/etc/yum.repos.d/rabbitmq-erlang.repo echo 'enabled=1'>>/etc/yum.repos.d/rabbitmq-erlang.repo yum install -y erlang # 安装 socat yum install -y socat # 安装 rabbitmq rpm -Uvh http://www.xnx3.com/down/rabbitmq/rabbitmq-server-3.7.8-1.el7.noarch.rpm # systemctl 操作 RabbitMQ服务 systemctl start rabbitmq-server systemctl status rabbitmq-server systemctl restart rabbitmq-server #设置为开机启动 systemctl enable rabbitmq-server # 开放端口 #增加rabbitMQ端口:5672 sudo firewall-cmd --add-port=5672/tcp --permanent #重新加载防火墙设置 sudo firewall-cmd --reload # rabbitmq 添加管理配置插件 #安装web管理页面插件(先启动rabbitmq服务): rabbitmq-plugins enable rabbitmq_management #开放端口 sudo firewall-cmd --add-port=15672/tcp --permanent #重新加载防火墙配置 sudo firewall-cmd --reload # Rabbit配置 #添加用户 rabbitmqctl add_user admin password #设置用户角色 rabbitmqctl set_user_tags admin administrator #tag(administrator,monitoring,policymaker,management) #设置用户权限(接受来自所有Host的所有操作) rabbitmqctl set_permissions -p "/" admin '.*' '.*' '.*' #查看用户权限 rabbitmqctl list_user_permissions admin # 配置远程访问 # 创建配置文件 touch /etc/rabbitmq/rabbitmq.config #保存以下内容 echo '['>>/etc/rabbitmq/rabbitmq.config echo '{rabbit, [{tcp_listeners, [5672]}, {loopback_users, ["admin"]}]}'>>/etc/rabbitmq/rabbitmq.config echo '].'>>/etc/rabbitmq/rabbitmq.config # 环境准备结束 # curl 更新,已避免curl漏洞 # 更新ca-bundle # 备份 cp /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt.bak # 更新并替换 curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt # 添加repo源 # 创建一个新文件 touch /etc/yum.repos.d/city-fan-for-curl.repo # 向其中添加内容 echo '[CityFanforCurl]'>>/etc/yum.repos.d/city-fan-for-curl.repo echo 'name=City Fan Repo'>>/etc/yum.repos.d/city-fan-for-curl.repo echo 'baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel7/x86_64/'>>/etc/yum.repos.d/city-fan-for-curl.repo echo 'enabled=0'>>/etc/yum.repos.d/city-fan-for-curl.repo echo 'gpgcheck=0'>>/etc/yum.repos.d/city-fan-for-curl.repo # 更新curl yum update curl --enablerepo=CityFanforCurl -y ## 修改 RabbitMQ 连接的用户密码 rabbitmqctl change_password admin 这里是你要修改成的密码 ````