To ensure that your fence is straight set the corner post first. Then stretch a string between them to use as a guide for setting the post in between
The holes for the post should be 3 feet deep with a minimum diameter of 10 inches. For maximum strength the post should be no more than 8 feet apart.
Fill bottom of holes with 3 inches of gravel. Set post on top of gravel and fill hole with concrete to within 2 to 3 inches of the top of the hole. Use a level to ensure post is perfectly vertical, then brace post until concrete sets. Backfill top of hole with 2 to 3 inches of dirt.
Once the concrete is set attach the rails by aligning the rail to the front side of the corner post, align other end of rail to center of its post. All remaining rails are aligned with the center of the posts.
Attach the pickets by aligning the first picket with the front edge of the corner post, all remaining pickets that attach at a post are centered over the seam in the rail ends. Space middle pickets evenly leaving a 3 or 4 inch gap between them.
Repeat steps 4 and 5 until your fence is complete. Now you have a fence that is not only functional but is aesthetically pleasing for you as well as your neighbors.
Because cedar will rot prematurely if set in concrete it is recommended that treated pine post be used for fences.
Since cedar is less resistant to warping and twisting it is recommended for the rails and pickets. But treated pine can be used if you are going to paint the fence. Pine will also be much less expensive.
If using treated pine use galvanized screws or nails, where cedar is used, aluminum screws and nails are recommended to reduce the reaction between the fasteners and the cedar.