It depends on what they are built from. In a 5.5" model, you can get your hand/arm down inside from the front, so if you use a T-nut that has a very thin flange, it is easy to insert one from the inside and screw the button in from the outside. You want it down below where the chute is to prevent snagging on anything. The rear one can be screwed into the rocket and into a centering ring, or you can add a small block at the bottom of the rear centering ring and screw the button into that. You can do something similar on smaller diameters if you can locate the T nut with a grabber etc.
For rockets made from fiberglass you can self tap or tap the fiberglass and that should be sturdy enough depending on the weight.
There are some ways to use a rubber grommet with a threaded insert, you drill a hole in the body tube, insert the screw through the rail button into the rubber grommet, insert grommet into the hole and tighten, the grommet squishes fatter and locks the button in place. You can also use some type of expanding screw anchor that goes into a hole and then expands when you tighten down on the screw.
On light rockets made from cardboard you can also just use a wood screw into the cardboard, remove and put some epoxy or CA on the cardboard to toughen up the threads in the cardboard, just depends on how much weight/stress they need to hold.
If you don't want a block at the rear visible, you drill/file a square hole near the body tube/rear centering ring, and slide the block up into the hole flush with the rear centering ring and against the body tube and then drill that for the button.....
I'm sure there are a million other ways to approach this, basically just need to be strong enough for the weight/launch stress and not have anything inside that will catch on your recovery system.
Frank