Any garden fence, whether made from chain link, wood or vinyl, will only ever be as strong as its posts. Since garden fence posts are the only means of support in many designs, it is vitally important that they are set correctly as well as making sure that they are well braced and straight.
Once you have determined where the fence posts should go, you should dig a hole at each spot, which is about a third of the length of the post plus six inches deep. The best way to dig is to use a post-hole digger, since it only removes the least amount of dirt needed, leaving the remainder for support. If you do not have one of those tools, a sturdy shovel will do, although you should try to remove no more soil than is necessary.
If you cannot dig down to a depth of a third of the length of the post plus six inches, you can provide extra support using a combination of more gravel and/or concrete around the post or additional bracing. More concrete will require a slightly wider hole.
Once the hole is empty, tamp down the earth inside the best you can and then fill at least half the hole with water and let it subside. Depending how long it takes to drain away will give a good indication of how loose the soil is as well as the type. Fast draining indicates loose or sandy soil. Less solid earth will need more gravel and/or concrete and perhaps a deeper and slightly wider hole.
Bear in mind that in most climates, rain will eventually soak the area around the post. The goal is to set the garden fence posts and build the fence to withstand a range of weather conditions, including high winds and torrential rain. Making the extra effort now will save you a lot of grief and repairs down the line.
Once the earth is tamped down, fill the bottom six inches with gravel, concrete, or both. Concrete should set enough to allow the post to stand up straight without support, but not enough to prevent inserting the post. That will vary from an hour to several hours depending on the sand and cement mix and the weather.
While you are waiting for the concrete to set, use the time to treat the post. If the post and fence is wood that is to be stained, stain the entire length. At minimum, treat the section that will go into the hole plus a few inches above. Moisture is the number one factor that will weaken a wood post prematurely. Even metal posts for chain link fencing should be treated with a preservative, in order to keep rust at bay.
At the right time, place the post and wiggle it around. This is to secure it into the gravel or to get rid of any air bubbles in the concrete between the post and mortar. To make sure it is straight, use a spirit level. If necessary, tie string around the post in three directions and stake it, tensioning the string to make and keep the post straight.
Leave everything sit for a minimum of twenty-four hours.
For additional strength, garden fence posts can be braced at the base. A slat attached at a 45 degree on at least two sides, preferably three, is one option. An L-brace that can be staked into the ground and attached to the post is an alternative option.
Place a small mound of earth and gravel at the base of each post in order to provide a method for water to run off.
If your ground is very firm, it is possible to use metal fence post stakes instead to provide a support for the post. These are square metal cups about six inches on an edge with a twelve to eighteen inch long spike at the base. They are hammered into the ground, and then the post is placed in the cup and secured with a nut and bolt. They can be very sturdy and support ample weight.