There are several meanings to "centered" and it's unclear which you mean:
1. Hub centered laterally between the forks: The quick releases and/or axle nuts do this automatically for you when you scrinch down on them. See: What do the conical springs in quick releases actually do?
2. Hub centered in the drop-outs: this is the most important. You want to make sure that the axle/quick-release fits as far into the drop-outs that it can go. Cinch up the axle nuts or quick-releases part of the way, then grip the brake levers (or have a friend grip them) as you fully tighten the nuts/quick release. That'll help ensure that the wheel is centered.
3. The above requires that your brakes are rim-brakes and are relatively centered. If not, you can use the top of the fork or the chain stays as a way to visually ensure your wheel is centered.
4. That your wheel itself is in true (a perfect flat disc) and not wobbly. See @CarpeTony's answer for that.