Locate the squeak in your floor, record the position where the squeak is coming from.
Fixing the Squeak
Hammer any loose nails you can find back into position. Fill the gaps between wood joists with shims. Slide shins both side of the gap to produce a tight and secure joint, avoid pushing the shims to further then required, once the squeak is resolved they do not need to be tampered with. Use caulk along both sides of the gap.
Reinforce the Joints
Screw nails into the sub-floor from above. Lift your carpet from the squeaky area and drill down, this will often tighten the joists in the floor.