A diode needs to be placed across the motor as shown in the crude diagram below. The diode should be placed as near to the motor as reasonably possible. This will reduce the wear from arcing across the relay contacts, as you have read.
What you should also try to do is prevent the sudden current change when a relay is energised from affecting the Raspberry Pi - you don't want it to have any chance of experiencing a voltage drop ("brown out") that resets it.
You can do that by using separate wires to the 5 V PSU and placing a decoupling capacitor (maybe 33 µF or whatever you have to hand around that value, or you can go and find out how to calculate the minimum required value) across Vcc-GND as close to the pins for them on the relay board as reasonably possible. The capacitor acts as a little reservoir of energy right next to where it is needed. For best results when doing that, also separate the common ground of the optoisolators from the relay coil ground.
I tried to emphasize that the power to the relay board and the power to the RPi should be kept separate in this circuit diagram:
simulate this circuit – Schematic created using CircuitLab
A bit of heatshrink to put over any wire-to-wire solder connections that you make might be a good idea to keep things safe and tidy - it's less messy than electrical tape.