Here are some steps to follow when preparing new wood for painting. First, countersink any finish nails. Then fill any nail holes and imperfections with a fast-drying wood filler. Caulk all the cracks and seams, smoothing out the caulk with your fingers. Sand smooth with fine sandpaper and seal any knots with a clear shellac (to prevent resins from bleeding through your finish paint). Now you are ready to prime and apply your finish coat.
For more on painting, consider:
Exterior Paint 101
Bob Vila Radio: Interior Paint Prep
Paint Makeovers: An Expert Tells All