The retainer is a precision-size, press fit piece, and a new one comes packaged with the replacement wheel bearing. We usually take a wide chisel and a BIG hammer, and with the axle sitting firmly on an anvll, make a couple of deep scores in the retainer. That loosens it so it's easier to press the bearing off the shaft. Press the new bearing and retainer on together. Be sure to change the seal in the bolt-on axle retainer if it has one.
Jerry