Installing RabbitMQ

RabbitMQ is written in Erlang. We need to install Erlang first. The Erlang version we will install is the customized version that the RabbitMQ team provides at https://github.com/rabbitmq/erlang-rpm.

Here are the steps to install the Erlang RPM:

  1. Download the RPM package using the following command:
wget https://github.com/rabbitmq/erlang-rpm/releases/download/v21.1/erlang-21.1-2.el6.x86_64.rpm
  1. Install RPM package with sudo:
sudo rpm -ivh erlang-21.1-2.el6.x86_64.rpm

Now, let's install RabbitMQ. We use the RPM package provided by Bintray:

  1. Download the RPM package:
wget https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.8/rabbitmq-server-3.7.8-1.el6.noarch.rpm
  1. Install the RPM package with the following commands:
sudo rpm -ivh rabbitmq-server-3.7.8-1.el6.noarch.rpm
  1. Set RabbitMQ to autostart when the server reboots, as follows:
sudo chkconfig rabbitmq-server on
  1. Create a user with the username app_user and the password GxweRTK, as shown here:
sudo rabbitmqctl add_user app_user GxweRTK
Do not add special characters to a RabbitMQ user's password, such as G$xweRTK. If so, the user will be able to log in with the command but will not able to pass authentication from the application. RabbitMQ will, for some reason, truncate the password to remove the special character.
Authentication is done with the following syntax: rabbitmqctl authenticate_user <username> <password>.
  1. Add the user to the administrator tag:
sudo rabbitmqctl set_user_tags app_user administrator
  1. Grant permissions to the user as follows:
sudo rabbitmqctl set_permissions -p / app_user ".*" ".*" ".*"
  1. Enable the management plugin (optional):
sudo rabbitmq-plugins enable rabbitmq_management

You can choose to enable the management plugin so that you can monitor the server from UI. For more information, check RabbitMQ's documentation at http://www.rabbitmq.com/management.html.

  1. Restart the server, as shown here:
sudo service rabbitmq-server restart

We do this because when you enable the management plugin, you will need to restart the server to make it work.

The preparation we use here is only for experimental purposes when you want to get your hands dirty. In practice, you will probably want to use a more automated way of preparing servers, such as Ansible, Puppet, Chef, and so on. Due to the fact that those topics are really out of the scope of this book, we introduce one of the most straightforward ways of setting up a server.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.119.81