代码改变世界

Install RabbitMQ on CentOS 7

2019-06-02 16:48  Wizardlsw  阅读(475)  评论(0编辑  收藏  举报

NOTE: this article is only for CentOS 7

How to Install RabbitMQ on CentOS 7

yum update

Install erlang

Reference: Install erlang (> v20)

Create file in /etc/yum.repos.d/rabbitmq_erlang.repo

# In /etc/yum.repos.d/rabbitmq_erlang.repo
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

Then run yum install erlang to install erlang package.

Install RabbitMQ

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

create repo file /etc/yum.repos.d/rabbitmq.repo (NOTE: this for 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

Install rabbitmq-server

I guess that the guideline is incorrect for the command yum install rabbitmq-server-3.7.15-1.el7.noarch.rpm and I got error like "No package rabbitmq-server-3.7.15-1.el7.noarch.rpm available.".
And then I manually download the latest version rabbitmq-server-3.7.15-1.el7.noarch.rpm from bintray: rabbitmq-server and use the command yum install rabbitmq-server-3.7.15-1.el7.noarch.rpm and get rabbitMQ installed.

Maybe I should try yum install rabbitmq-server.

Start RabbitMQ

The server is not started as a daemon by default when the RabbitMQ server package is installed. To start the daemon by default when the system boots, as an administrator run

chkconfig rabbitmq-server on

Here is the output:

[slin@zero downloads]$ sudo chkconfig rabbitmq-server on
Note: Forwarding request to 'systemctl enable rabbitmq-server.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.

As an administrator, start and stop the server as usual:

/sbin/service rabbitmq-server start

/sbin/service rabbitmq-server stop

Access RabbitMQ management console

For this section, you can also refer to access RabbitMQ management console
RabbitMQ management console will allow you to monitor the server processes via a web browser.

To enable the RabbitMQ management console, run the following command:

rabbitmq-plugins enable rabbitmq_management
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/

Now. open your web browser and navigate to the following URL to access your RabbitMQ server management console.

http://ip-address:15672/

The default user name and password of RabbitMQ Management console is ‘guest’ and ‘guest’ (but it can only be logged in localhost).

However, you can create a new admin user if you want.

To do so, run:

rabbitmqctl add_user mqadmin mqadmin
rabbitmqctl set_user_tags mqadmin administrator
rabbitmqctl set_permissions -p / mqadmin ".*" ".*" ".*"