Defences will protect against zombies and enemy personnel.
In some countries or states guns are illegal without good reason, and if that reason is "because the undead are coming," people might look at you as if you were crazy.
However, some guns are legal if a test is passed, and even if buying them is impractical, most farmers would have them, so rural areas are a good option for foraging for guns. The best guns for the zombie apocalypse are assault rifles and long range rifles.
Walls and Fences:
Walls and fences should be primary defences. Although they work well, it is necessary to know how to mix mortar/cement and ideal placements for maximum defence. Cinder blocks for walls and chain link for fences are easier to reinforce than bricks and wooden fences. Corrigated iron roofs can be used to reinforce walls and fences.
Barbed wire should be put at the top of fences/walls. It helps to deter raiding more so than it defends against zombie hordes.
Doors and Windows:
If possible, heavy duty windows and metal doors should be used in any base. Combining a good deadbolt and a metal rod for locking doors works exceptionally well. It is also recommended to barricade all of the downstair windows with the sturdiest available materials.
Using bricks, wood or concrete to towers and platforms can be made. They should be located in areas where they can get a large view of the encampment, preferably a 360° view. Machine gun nests are also useful addition to any base. Sandbags and small chunks of wood can support them.
A strong gate is imperative for the maintainment of the security of any base.
Solar panels or diesel generators are viable sources of energy.
Fresh food is a beneficial addition to any group of survivors, as is having some sort of well or water purification system. This may not seem like a defense, but it is because going out on runs more often increases the chance of death tremendously.