Use QGroundControl and switch to the Setup view. Select the Power Configuration on the left. Click on the 'start assignment' button.
After the first beep, turn the propeller on the first ESC swiftly into the correct turn direction. The ESCs will all beep each time one is enumerated. Repeat this step for all motor controllers in the order as shown on the motor map. This step has to be performed only once and does not need to be repeated after firmware upgrades.