I've always done it just as Rod said, but the bolt/nut Kurt mentioned would be safer.
When using a hammer and punch on the bearing, be sure to wear a face shield or at least safety glasses. I know two people who have lost an eye when they were using a hammer and punch to drive a bearing.