Install RabbitMQ on CentOS

Install Erlang

RabbitMQ was written using the Erlang programming language, which must be installed on the same system as RabbitMQ.

See Manual installation for more information.

Refer to the RabbitMQ/Erlang version matrix to install the correct version.

Install RabbitMQ

The RabbitMQ server is included on CentOS, but the version is often old. RabbitMQ recommends installing the package from their website.

Refer to the RabbitMQ install page to get the latest supported version. Adobe Commerce 2.3 and 2.4 support RabbitMQ 3.8.x.

Refer to Installing on RPM-based Linux for more information.

Configure RabbitMQ

Review the official RabbitMQ documentation to configure and manage RabbitMQ. Pay attention to the following items:

  • Environment variables
  • Port access
  • Default user accounts
  • Starting and stopping the broker
  • System limits

Install with RabbitMQ and connect

If you install Adobe Commerce after you install RabbitMQ, add the following command-line parameters during installation:

--amqp-host="<hostname>" --amqp-port="5672" --amqp-user="<user_name>" --amqp-password="<password>" --amqp-virtualhost="/"

Where:

ParameterDescription
--amqp-hostThe hostname where RabbitMQ is installed.
--amqp-portThe port to use to connect to RabbitMQ. The default is 5672.
--amqp-userThe username for connecting to RabbitMQ. Do not use the default user guest.
--amqp-passwordThe password for connecting to RabbitMQ. Do not use the default password guest.
--amqp-virtualhostThe virtual host for connecting to RabbitMQ. The default is /.
--amqp-sslIndicates whether to connect to RabbitMQ. The default is false. If you set the value to true, see Configure SSL for more information.

Connect RabbitMQ

If you already had Adobe Commerce installed and you want to connect it to RabbitMQ, add a queue section in the <install_directory>/app/etc/env.php file so that it is similar to the following:

'queue' =>
  array (
    'amqp' =>
    array (
      'host' => 'rabbitmq.example.com',
      'port' => '11213',
      'user' => 'magento',
      'password' => 'magento',
      'virtualhost' => '/'
     ),
  ),

You can also set RabbitMQ configuration values using the bin/magento setup:config:set command:

bin/magento setup:config:set --amqp-host="rabbitmq.example.com" --amqp-port="11213" --amqp-user="magento" --amqp-password="magento" --amqp-virtualhost="/"

After the running the command or updating the <install_directory>/app/etc/env.php file with AMQP configuration values, run bin/magento setup:upgrade to apply the changes and create the required queues and exchanges in RabbitMQ.

Configure SSL

To configure support for SSL, edit the ssl and ssl_options parameters in the <install_directory>/app/etc/env.php file so that they are similar to the following:

'queue' =>
  array (
    'amqp' =>
    array (
      'host' => 'rabbitmq.example.com',
      'port' => '11213',
      'user' => 'magento',
      'password' => 'magento',
      'virtualhost' => '/',
      'ssl' => 'true',
      'ssl_options' => [
            'cafile' =>  '/etc/pki/tls/certs/DigiCertCA.crt',
            'certfile' => '/path/to/magento/app/etc/ssl/test-rabbit.crt',
            'keyfile' => '/path/to/magento/app/etc/ssl/test-rabbit.key'
       ],
     ),
  ),

Start the message queue consumers

After you have connected Adobe Commerce and RabbitMQ, you must start the message queue consumers. See Configure message queues for details.