安装rabbitmq
2020-01-29 16:02:45来源:博客园 阅读 ()
安装rabbitmq
一.安装erlang
先新建rabbitmq文件夹
cd /usr/local/src/
mkdir rabbitmq
cd rabbitmq
//下载rpm,如果下载速度慢可以本地下载上传Linux中也可
wget https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_21.2.2-1~centos~7_amd64.rpm
//导入公钥
rpm –import http://packages.erlang-solutions.com/rpm/erlang_solutions.asc
//安装自动更新依赖(不建议使用rpm安装)
yum install esl-erlang_21.2.2-1~centos~7_amd64.rpm
//验证是否安装成功
erl
二.安装rabbitmq
//下载rabbitmq
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.9/rabbitmq-server-3.7.9-1.el7.noarch.rpm
//导入RabbitMQ signing key.Before the Yum repository can be used, RabbitMQ signing key must be imported first. This makes RPM tools trust the signature on the packages provided in the repository. To do so, run rpm --import as a superuser:
rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
或者
//RabbitMQ public signing key is also available from rabbitmq.com
rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
//新增文件.In order to use the Yum repository, a .repo file (e.g. rabbitmq.repo) has to be added under the /etc/yum.repos.d/ directory. The contents of the file will vary slightly between distributions (e.g. CentOS 7 vs. CentOS 6 vs. OpenSUSE). The following example targest CentOS 7:
[bintray-rabbitmq-server]
name=bintray-rabbitmq-rpm
baseurl=https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.7.x/el/7/
gpgcheck=0
repo_gpgcheck=0
enabled=1
On CentOS 6 the baseurl line would be slightly different:
[bintray-rabbitmq-server]
name=bintray-rabbitmq-rpm
baseurl=https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.7.x/el/6/
gpgcheck=0
repo_gpgcheck=0
enabled=1
The following example targets OpenSUSE:
[bintray-rabbitmq-server]
name=bintray-rabbitmq-rpm
baseurl=https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.7.x/opensuse/42.1/
gpgcheck=0
repo_gpgcheck=0
enabled=1
The following example targets SLES 11.x:
[bintray-rabbitmq-server]
name=bintray-rabbitmq-rpm
baseurl=https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.7.x/sles/11
gpgcheck=0
repo_gpgcheck=0
enabled=1
//安装rabbitmq
yum install rabbitmq-server-3.7.9-1.el7.noarch.rpm
rpm -ivh --nodeps rabbitmq-server-3.7.9-1.el7.noarch.rpm
三.可能出现的问题
1、如果出现如下错误,但是的确安装了erlang对应版本:
error: Failed dependencies:
erlang >= R16B-03 is needed by rabbitmq-server-3.6.3-1.noarch
复制代码
解决方式:
添加--nodeps你的rpm命令,参考连接:StackOverflow问答
rpm -ivh --nodeps rabbitmq-server-3.5.7-1.noarch.rpm
复制代码
检查https://stackoverflow.com/a/40218299/877813,并添加--nodeps你的rpm命令
2、出现如下错误的情况;说缺少socat依赖
socat is needed by rabbitmq-server-3.6.6-1.el6.noarch
复制代码
解决方式:
yum -y install socat
此时会报错没有socat包或是找不到socat包,解决方法安装centos的epel的扩展源
yum -y install epel-release
之后执行yum -y install socat
安装时如果遇到下面的依赖错误:
Error: Package: socat-1.7.2.3-1.el6.x86_64 (epel) Requires: libreadline.so.5()(64bit)
可以尝试先执行:
yum install socat
四.启动和配置
1.RabbitMQ的一些基本操作:
# 添加开机启动RabbitMQ服务
systemctl enable rabbitmq-server.service
# 查看服务状态
systemctl status rabbitmq-server.service
# 启动服务
systemctl start rabbitmq-server.service
# 停止服务
systemctl stop rabbitmq-server.service
# 查看当前所有用户
rabbitmqctl list_users
# 查看默认guest用户的权限
rabbitmqctl list_user_permissions guest
# 由于RabbitMQ默认的账号用户名和密码都是guest。为了安全起见, 先删掉默认用户
rabbitmqctl delete_user guest
# 添加新用户
rabbitmqctl add_user username password
# 设置用户tag
rabbitmqctl set_user_tags username administrator
# 赋予用户默认vhost的全部操作权限
rabbitmqctl set_permissions -p / username ".*" ".*" ".*"
# 查看用户的权限
rabbitmqctl list_user_permissions username
2、基本配置:(配置的时候输入命令需要在/usr/local/src/ rabbitmq文件夹)
//开启管理页面插件
rabbitmq-plugins enable rabbitmq_management
管理插件安装完成后,出现如下提示,表示安装成。
The following plugins have been enabled:
mochiweb
webmachine
rabbitmq_web_dispatch
amqp_client
rabbitmq_management_agent
rabbitmq_management
Plugin configuration has changed. Restart RabbitMQ for changes to take effect.
增加访问用户,默认用户guest只能本地访问。
rabbitmqctl add_user admin eternityzhang
设置角色:
rabbitmqctl set_user_tags admin administrator
设置默认vhost(“/”)访问权限
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
关于RabbitMQ的配置,可以下载RabbitMQ的配置文件模板到/etc/rabbitmq/rabbitmq.config, 然后按照需求更改即可。
关于每个配置项的具体作用,可以参考官方文档。
https://github.com/rabbitmq/rabbitmq-server/blob/master/docs/rabbitmq.config.example
搜索到%%{loopback_users,[]}, 去掉%%和最后的逗号并保存
开机自启动:
chkconfig rabbitmq-server on 输入之后会转到systemctl enable rabbitmq-server.service
可以用浏览器输入localhost:15672,账号密码输入admin/eternityzhang即可登录:
参考
链接:https://juejin.im/post/5af879e76fb9a07ab11144b6
链接: https://www.jianshu.com/p/86c28453a50b
原文链接:https://www.cnblogs.com/eternityz/p/12239590.html
如有疑问请与原作者联系
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
下一篇:idea新建项目相关名词意义
- Maven安装与配置 2020-06-09
- java环境教程:Tomcat下载,安装,设置为Windows服务,启动 2020-06-09
- Centos下Zookeeper的安装部署 2020-06-06
- Elastic APM安装 2020-06-06
- ElasticSearch7.4.2安装、使用以及与SpringBoot的整合 2020-05-27
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash