[CentOS7] Install RabbitMQ Using PackageCloud Yum Repository

Set-up Yum Repository

A quick way to set up the repository is to use a Package Cloud-provided script. It is not a requirement and should be carefully considered since it pipes a generated script from the public Internet to a privileged shell. 

# Uses a PackageCloud-provided Yum repository setup script.
## Always verify what is downloaded before piping it to a privileged shell!

## for erlang
curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash

## for rabbitmq
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash

 View the installed repositories in the "/etc/yum.repos.d" directory.

[itboone@localhost yum.repos.d]$ pwd
/etc/yum.repos.d
[itboone@localhost yum.repos.d]$ ls
CentOS-Base.repo      CentOS-Debuginfo.repo  CentOS-Sources.repo        rabbitmq_erlang.repo
CentOS-Base.repo.bak  CentOS-fasttrack.repo  CentOS-Vault.repo          rabbitmq_rabbitmq-server.repo
CentOS-CR.repo        CentOS-Media.repo      CentOS-x86_64-kernel.repo
[itboone@localhost yum.repos.d]$ 

Install Packages with Yum

Update Yum package metadata:

yum update -y
yum -q makecache -y --disablerepo='*' --enablerepo='rabbitmq_erlang' --enablerepo='rabbitmq_rabbitmq-server'

Next install dependencies from the standard repositories:

## install these dependencies from standard OS repositories
yum install socat logrotate -y

Finally, install modern Erlang and RabbitMQ:

## install RabbitMQ and zero dependency Erlang from the above repositories,
## ignoring any versions provided by the standard repositories
yum install erlang rabbitmq-server -y

Start RabbitMQ

# Service Mode1
service rabbitmq-server start
# Service Mode2
systemctl start rabbitmq-server
# App Mode
cd /usr/lib/rabbitmq/bin/
# Starting in the background
./rabbitmq-server -detached
# Starting directly: Exit the terminal or execute ctrl+D to terminate
./rabbitmq-server start

Enable Plugins

# Enable Plugin
rabbitmq-plugins enable rabbitmq_management rabbitmq_prometheus

# View Plugin List
rabbitmq-plugins list
isting plugins with pattern ".*" ...
 Configured: E = explicitly enabled; e = implicitly enabled
 | Status: * = running on rabbit@centos156
 |/
[  ] rabbitmq_amqp1_0                  3.10.0
[  ] rabbitmq_auth_backend_cache       3.10.0
[  ] rabbitmq_auth_backend_http        3.10.0
[  ] rabbitmq_auth_backend_ldap        3.10.0
[  ] rabbitmq_auth_backend_oauth2      3.10.0
[  ] rabbitmq_auth_mechanism_ssl       3.10.0
[  ] rabbitmq_consistent_hash_exchange 3.10.0
[  ] rabbitmq_event_exchange           3.10.0
[  ] rabbitmq_federation               3.10.0
[  ] rabbitmq_federation_management    3.10.0
[  ] rabbitmq_jms_topic_exchange       3.10.0
[E*] rabbitmq_management               3.10.0
[e*] rabbitmq_management_agent         3.10.0


# Restart Service
systemctl restart rabbitmq-server.service

# Displays Network Status
netstat -pltn
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      3081/beam.smp       
tcp        0      0 0.0.0.0:15692           0.0.0.0:*               LISTEN      3081/beam.smp  # prometheus metrics     
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN      3211/epmd                  
tcp        0      0 0.0.0.0:15672           0.0.0.0:*               LISTEN      3081/beam.smp       
tcp6       0      0 :::5672                 :::*                    LISTEN      3081/beam.smp    

# Test Metrics API
curl localhost:15692/metrics

# Test Management UI
Browser access: http://{Host address}:15672/
Notes: User[guest] can only log in via localhost.

Create Admin User

# Create user
rabbitmqctl add_user admin admin
# Set user tags
rabbitmqctl set_user_tags admin  administrator
# Set user permissions
rabbitmqctl set_permissions -p / admin  ".*" ".*" ".*"

Other Commands

# View RabbitMQ service status
service rabbitmq-server status
# View RabbitMQ service status
systemctl status rabbitmq-server

# View RabbitMQ node status
rabbitmqctl status
# Start RabbitMQ application when Erlang VM running
rabbitmqctl start_app
# Stop RabbitMQ application when Erlang VM running
rabbitmqctl stop_app

# List users
rabbitmqctl list_users
# List VHosts
rabbitmqctl list_vhosts
# View all user permission info of the specified Vhostpath
rabbitmqctl  list_permissions  [-p  VHostPath]
# View the permission info of the specified user
rabbitmqctl  list_user_permissions  [username]
# Clear the permission info of the specified user
rabbitmqctl  clear_permissions  [-p VHostPath]  [username]
# Remove all data. Use it after "rabbitmqctl stop_app".
rabbitmqctl reset

# Stop RabbitMQ only for service mode
service rabbitmq-server stop
# Stop RabbitMQ only for service mode
systemctl stop rabbitmq-server
# Stop RabbitMQ with rabbitmqctl
rabbitmqctl stop
# Stop RabbitMQ with kill
ps -ef|grep rabbitmq
kill -9 <pid>

Log in to the web management page using the Admin account:

Reference

Installing on RPM-based Linux (RedHat Enterprise Linux, CentOS, Fedora, openSUSE) — RabbitMQhttps://www.rabbitmq.com/install-rpm.html#package-cloud

CentOS7 安装配置RabbitMQ3.8.x [yum方式]_毛小威的博客-CSDN博客https://blog.csdn.net/oyym_mv/article/details/108345779

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值