The preferred way of installing magnets is by using screws. A hole needs to be drilled in the magnet and into the material which is under the magnet, so that you can place a screw through it. This is ideal when you are installing the magnet in a wooden wall. Washers will be needed if the screw head you are using is quite small, but this is not a requirement always. Screws prove to be ideal for fixing because they are easily removable, if some kind of mistake has been made.
When permanent magnets have to be attached to surfaces which are metallic, then screws cannot be used. Here too, drilling of a hole is needed through the magnet and metal. Then instead of a screw you will have to put a bolt in the drilled hole and the nut will have to be attached on the reverse side. The nut has to be threaded down tightly so that it is firm.
In certain situations you might have to make a wooden frame or of a similar material so that the magnet can be fitted in the frame. You could visualize this installation in the way a glass pane is fitted into a photo frame. The magnet takes the place of the glass and is fitted into the frame grooves. This way the magnet will be held in place without having to use any extra hardware. Also in this process no drilling of a hole is required for the magnet, and that will ensure that the magnet does not get cracked or broken during installation.
These are not the only ways of installing permanent magnets and there are other ways as well to fit a magnet properly. Some people like to use an adhesive or glue for installing the magnet. It all depends on the situation and if the situation is not ordinary you might have to find some unique solution. Just make sure that you have considered all the uses the magnet will provide in future before you install them, so that the way you install them is correct and will not hinder their uses.