查看“Centos7安装Rabbitmq”的源代码
←
Centos7安装Rabbitmq
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
=pre= Rabbitmq基于erlang语言开发,因此需要安装erlang虚拟机 =Install Erlang= ==添加国内epel源 必要的为了后面的erlang依赖== <pre> ###1、备份(如有配置其他epel源) mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup ###2、下载新repo 到/etc/yum.repos.d/ #epel(RHEL 7) wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo #重新生成缓存: yum makecache #yum install erlang -y </pre> <pre> echo '[rabbitmq-erlang] name=rabbitmq-erlang baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/21/el/7 gpgcheck=1 gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc repo_gpgcheck=0 enabled=1' >/etc/yum.repos.d/rabbitmq-erlang.repo #erlang21 yum install erlang -y # rpm --import https://packages.erlang-solutions.com/rpm/erlang_solutions.asc echo '[erlang-solutions] name=CentOS $releasever - $basearch - Erlang Solutions baseurl=https://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch gpgcheck=1 gpgkey=https://packages.erlang-solutions.com/rpm/erlang_solutions.asc enabled=1' >/etc/yum.repos.d/myerlang.repo #只能是这个不用翻墙 #将里面的baseurl 改为:baseurl=https://mirrors4.tuna.tsinghua.edu.cn/erlang-solutions/centos/7/ 如下 cat myerlang.repo echo '[erlang-solutions] name=CentOS $releasever - $basearch - Erlang Solutions #baseurl=https://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch baseurl=https://mirrors4.tuna.tsinghua.edu.cn/erlang-solutions/centos/7/ #gpgcheck=1 gpgcheck=0 gpgkey=https://packages.erlang-solutions.com/rpm/erlang_solutions.asc enabled=1' > /etc/yum.repos.d/myerlang.repo yum makecache yum install erlang socat -y #上面这些有空要构建自己的yum 仓库</pre> https://www.erlang-solutions.com/resources/download.html centos <pre> #二进制包 https://bintray.com/rabbitmq/rpm/erlang/21.0.4-1 https://github.com/rabbitmq/erlang-rpm 验证是否安装成功,输入命令:erl erlang >= 19.3 被 rabbitmq-server-3.7.7-1.el7.noarch 需要 socat 被 rabbitmq-server-3.7.7-1.el7.noarch 需要 erl Erlang R16B03-1 (erts-5.10.4) </pre> == rpm 安装erlang== #翻墙下载 wget https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_19.2~centos~7_amd64.rpm #add epel if not yum install unixODBC unixODBC-devel wxBase wxGTK SDL wxGTK-gl http://www.cnblogs.com/knowledgesea/p/6291085.html =Install rabbitmq= <pre> #这个要翻墙 wget -c https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.7/rabbitmq-server-3.7.7-1.el7.noarch.rpm rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc # this example assumes the CentOS 7 version of the package yum install rabbitmq-server-3.7.7-1.el7.noarch.rpm #um就会去自动下载对应依赖包 yum install rabbitmq-server-3.7.7-1.el7.noarch.rpm #我是直接 rpm -ivh rpm -ivh rabbitmq-server-3.7.7-1.el7.noarch.rpm --nodeps --force #强制安装了 #unstall yum remove rabbitmq-server erlang </pre> == 添加软件源== wget -c https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh && bash -x script.sh yum install -y rabbitmq-server =docker rabbitmq= ==docker-compose rabbitmq== === install docker-ce === [[Docker and docker-compose快速安装]] <pre> #install docker yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine yum install -y yum-utils \ device-mapper-persistent-data \ lvm2 yum-config-manager \ --add-repo \ https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo yum makecache fast yum install docker-ce -y systemctl enable docker systemctl start docker yum -y install vim wget curl yum-utils bash-completion bash-completion-extras epel-release lrzsz telnet python-pip pip install docker-compose mkdir -p /home/data/docker echo '{"graph": "/home/data/docker"}' >/etc/docker/daemon.json # cat /etc/docker/daemon.json {"graph": "/home/data/docker"} systemctl restart docker #验证docker储存位置 docker system info | grep "Root Dir" </pre> [http://wiki.linuxchina.net/index.php?title=%E4%BD%BF%E7%94%A8kubeadm%E7%A6%BB%E7%BA%BF%E9%83%A8%E7%BD%B2kubernetesv1.9.0_on_centos7#.E5.AE.89.E8.A3.85docker-ce dokcer-ce install] ===docker ins mq start=== <pre> docker pull rabbitmq:3.6.10-management mkdir -p /home/data/docker-compose-cailuw-market vi docker-compose.yml version: '3.1' #"登录容器请执行:rabbitmq-plugins enable rabbitmq_management 才可>使用WEB管理页面" services: rabbitmq: image: rabbitmq:3.6.10-management ports: - "5672:5672" - "15672:15672" hostname: dev-market-rabbit environment: RABBITMQ_DEFAULT_VHOST: / RABBITMQ_DEFAULT_USER: admin RABBITMQ_DEFAULT_PASS: root RABBITMQ_LOGS: /var/lib/rabbitmq/rabbitmq.log RABBITMQ_SASL_LOGS: /var/lib/rabbitmq/rabbitmq-sasl.log volumes: - ./data/rabbitmq:/var/lib/rabbitmq restart: always docker-compose up -d rabbitmq #docker-compose -f file -d rabbitmq #docker-compose -f docker-compose-base.yml -f docker-compose-prod.yml up -d mysql PS:启动语句最后用rabbitmq:3.7.7-management而不是imageId,否则之后一堆容器看起来像坨屎一样 </pre> =配置= <pre> 创建rabbitmq的配置文件,并允许guest进行登录 echo '[{rabbit, [{loopback_users, []}]}].' > /etc/rabbitmq/rabbitmq.config</pre> =更改rabbitmq的环境变量= <pre> -- -home /var/lib/rabbitmq #没做 /var/lib/rabbitmq/.erlang.cookie # cat /etc/rabbitmq/rabbitmq-env.conf RABBITMQ_MNESIA_BASE=/data/rabbitmq/mnesia RABBITMQ_LOG_BASE=/data/rabbitmq/log #ll rabbitmq-env.conf -rw-r--r-- 1 rabbitmq rabbitmq 80 Nov 10 18:35 rabbitmq-env.conf</pre> ==创建数据目录和log目录== <pre> #mkdir -pv /data/rabbitmq/log #chowm -R rabbitmq:rabbitmq /data/rabbitmq</pre> <pre> 启用management插件 rabbitmq-plugins enable rabbitmq_management http://blog.51cto.com/zengestudy/1870247 systemctl start rabbitmq-server systemctl enable rabbitmq-server#开机自动启动 rabbitmqctl status #查看 rabbitmq-server 状态</pre> ==管理RabbitMQ== <pre> #早上不行的原因是输入为家里的网段 rabbitmq-plugins enable rabbitmq_management 开启插件管理页面 rabbitmqctl add_user admin 123456 Creating user "admin" ... [root@localhost sbin]# ./rabbitmqctl set_user_tags admin administrator Setting tags for user "admin" to [administrator] ... http://IP:15672/#/ 可以用刚建立的管理员用户登陆管理界面了 注意:系统自带账号guest具有所有的操作权限,并且又是默认账号,出于安全因素的考虑,guest用户只能通过localhost登陆使用,建议修改guest用户的密码以及新建其他账号管理使用rabbitmq。 Not management user (1) 新增一个用户 rabbitmqctl add_user Username Password 添加admin账号,赋予administrator权限 rabbitmqctl add_user admin password rabbitmqctl set_user_tags admin administrator </pre> ===开启管理UI=== <pre> echo '[{rabbit, [{loopback_users, []}]}].' >/etc/rabbitmq/rabbitmq.config rabbitmq-plugins enable rabbitmq_management #重启服务 systemctl restart rabbitmq-server #这个在7上有可能是不行的$ service rabbitmq-server restart 访问管理UI #这个有空要做安全配置 通过 http://ip:15672 使用guest,guest 进行登陆了 上面的新建用户 好像不行 可以 在web 界面添加</pre> [https://segmentfault.com/a/1190000010693696#articleHeader4 开启管理UI相关] [https://segmentfault.com/a/1190000010693696#articleHeader13 CentOs7.3 搭建 RabbitMQ 3.6 单机服务与使用 have user etc] ===改进=== 配置有空要优化一下 看相关的see also =trouble shooting= == 利用国内源yum 安装erlang 21== #将里面的baseurl 改为:baseurl=https://mirrors4.tuna.tsinghua.edu.cn/erlang-solutions/centos/7/ 如下 <pre> echo '[erlang-solutions] name=CentOS $releasever - $basearch - Erlang Solutions #baseurl=https://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch baseurl=https://mirrors4.tuna.tsinghua.edu.cn/erlang-solutions/centos/7/ #gpgcheck=1 gpgcheck=0 gpgkey=https://packages.erlang-solutions.com/rpm/erlang_solutions.asc enabled=1' > /etc/yum.repos.d/myerlang.repo yum clean all yum makecache yum install erlang #21</pre> == yum --skip-broken问题 == <pre>您可以尝试添加 --skip-broken 选项来解决该问题 #这个也可以 试一下 不建议用 ,今天遇到 其实加上 epel 依赖搞定就行了 您可以尝试执行:rpm -Va --nofiles --nodigest <pre>yum remove erlang* #因为是安装erlang后出问题 网上的教程不要信 ,还是自己想到的办法 yum clean all yum makecache yum install socat erlang -y </pre> ==没添加epel源的依赖问题== 记住 一定要添加epel源 不然安装rabbitmq 会识别不到 已安装的Erlang/OTP 21 ==15672 问题== 15672 本地可以 telnet ,但是在其它机器上 telnet 不通 , web 也访问不了 </pre> =see also= [https://www.cnblogs.com/yufeng218/p/9452621.html docker 安装rabbitMQ] [http://witmax.cn/rabbitmq.html rabbitmq 源码安装和使用] [http://www.rabbitmq.com/install-rpm.html#install-erlang Install Erlang] [http://www.rabbitmq.com/install-rpm.html#with-rpm Installing on RPM-based Linux] [http://blog.51cto.com/zengestudy/1870247 RPM包安装RabbitMQ_good] [http://www.cnblogs.com/astroboyx/archive/2012/04/09/2739902.html Linux下 RabbitMQ的安装与配置] [https://www.jianshu.com/p/27197d58e94c 使用国内源安装erlang] [https://feng19.github.io/2018/04/08/erlang-solutions-%E5%9B%BD%E5%86%85%E9%95%9C%E5%83%8F%E5%9C%B0%E5%9D%80/ erlang-solutions-ubuntu国内镜像地址] [https://www.cnblogs.com/xueweihan/p/7099641.html CentOS 7 下安装 RabbitMQ] [http://www.ttlsa.com/linux/install-rabbitmq-on-linux/ 消息队列服务rabbitmq安装配置ttlsa] [https://blog.zfanw.com/install-erlang-on-centos/ CentOS 安装 Erlang] [http://blog.51cto.com/qwfys200/2105724 在Centos7上安装Rabbitmq 3.7] [[category:ops]]
返回至
Centos7安装Rabbitmq
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
我的导航
关于我
shell
python
ops
linuxchina.net
blog.linuxchina
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息