Simply gluing them on might work, but I've never done that. What I have done is:
Option 1) Drill a hole in the airframe for each rail button in the airframe very slightly undersized. Screw in the rail button+screw and see how much too long it is. Using an angle grinder or Dremel, grind off the excess until it doesn't extend through the tube. Clean-up any burrs. Smear epoxy on the screw and bottom on the button where it will contact the ariframe on the outside and screw it back into the hole. Don't torque it, you'll just make the hole too big. I have used this approach and also just used one or two little washers so I don't have to grind off the screw. Those get bonded to the button, each other, and the airframe (when I do this, I use JBWeld with success).
Option 2) Using a popsicle stick or other small piece of wood, fashion a little standoff. Drill it for the button. Glue up the button, screw and standoff with epoxy. If the screw extends through your piece of wood, clean-up extra epoxy on the back of the wood and allow to dry. Drill a hole in the airframe to accept the little extra screw nub, if you have one. Now epoxy the standoff to the airframe. It will have more surface area to help bond better to the airframe.
I have done both of these, and they work. When doing either, rough up the bonding surface of the rail button with 60-grit sandpaper.
--Lance.