The mezuzah is installed on the side of the jamb that is external to the room, i.e. in front of the entrance. However, if there are concerns that the mezuzah may be stolen or damaged, it is allowed to attach it indoors.
The mezuzah should be located in the lower part of the upper third of the height of the jamb, no further than 8 cm from its upper edge. If the door is so high that the mezuzah attached to the upper third is noticeably higher than the shoulder of a person of average height, it should be attached lower; if the door, on the contrary, is low, the mezuzah should be attached higher, but no closer than 8 cm from the lintel.
It is customary for the mezuzah to be slightly tilted in the direction of the entrance, but if the jamb is too narrow, the mezuzah is hung vertically.