# Installing RabbitMQ

This section explains how to install RabbitMQ for clustered and non-clustered servers.

Note: See Troubleshooting for information on specific troubleshooting scenarios.

1. If clustering multiple servers together, perform the following:
   - Create a new system Environment Variable to each Document Generation Services (DGS) server.
     - Variable Name = `RABBITMQ_BASE`
     - Variable Value = `C:\ProgramData\RabbitMQ`
     Note: This step is mandatory; if not completed, all RabbitMQ configuration information is placed at `C:\Users\<current user>\AppData\Roaming\RabbitMQ`. This path is incompatible if multiple users access the server hosting RabbitMQ.
   - Pre-create the `rabbitmq.config` file, with the clustering content (see below), and then place into the `C:\ProgramData\RabbitMQ` folder (on all clustered servers). A `rabbitmq.config` file is required to define the servers for the cluster. Update the server names for your environment. See Appendix: rabbitmq.config file for a sample .config file.
     Note: Consider the following:
     - Verify the file name is rabbitmq.config and is not saved as a .txt file.
     - Enter the server names in UPPERCASE.
   - Pre-create the `.erlang.cookie` file with a preferred value.
     Note: A-Z, 0-9, Uppercase, lowercase and underscore values only
   - Copy the `.erlang.cookie` file to the following locations on all clustered DGS servers:
     - `C:\windows\.erlang.cookie`
     - `C:\Users\<UserThatInstalledERLang>\.erlang.cookie`

     See Appendix: Configuring additional Document Generation Services resources for more information.

   - Install erlang: Install `otp_win64_19.1.exe` (erl 8.1) from http://www.erlang.org/download.html; the default options are recommended.
   - Install RabbitMQ: Install `rabbitmq-server-3.6.5.exe` from https://www.rabbitmq.com/download.html; the default options are recommended; allow the service to install and start
   - From a command prompt (run as admin), enter `C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.5\sbin`; execute `rabbitmq-plugins enable rabbitmq_management`.
     Note: If you receive an error stating Erlang cannot be located, check if a previous command prompt was open.
2. If not clustering servers, perform the following:
   - Create a new system Environment Variable to each Document Generation Services (DGS) server.
     - Variable Name = `RABBITMQ_BASE`
     - Variable Value = `C:\ProgramData\RabbitMQ`
   - Install erlang: Install `otp_win64_19.1.exe` (erl 8.1) from http://www.erlang.org/download.html; the default options are recommended.
   - Install rabbitMQ: Install `rabbitmq-server-3.6.5.exe` from https://www.rabbitmq.com/download.html.
   - Confirm that rabbit is functioning properly. This enables a web UI for a Management application at http://localhost:15672; username and password are both “guest."

Repeat these steps for every server that hosts the main Document Generation Services application. Note that this procedure does not apply to servers that only host the Scheduler Service.