Locate the ceiling joists by running a stud finder along the ceiling where the cabinet is to be installed. Mark each joist with a pencil.
Mark out the intended location of the cabinet on the ceiling with a pencil. Measure in from the left and right sides of the future cabinet placement to the joist location marks. Using these measurements, mark out the location of the joists on the upper inside panel of the cabinet and make a small "X" at the joist locations. There should be two joist marks for each joist, 2 inches in from the edge of the cabinet's upper panel.
Use this step only if the cabinet is to have a 3- to 4-inch crown molding attached to it. Measure the full length of the cabinet. Cut two lengths of 2-by-4 stud to match the length of the cabinet using a skill saw to make the cut. Attach the cut stud lengths to the top of the cabinet along the front and back edge with 2-inch wood screws. These studs will give the cabinet the needed distance from the ceiling to allow for crown installation. If the cabinet will not have crown molding attached to it, move on to Step 4.
Drill a 3/8-inch diameter pilot hole at each of the joist location marks on the upper inside panel of the cabinet. Drill a 1/4-inch diameter pilot hole at each of the joist location marks in the ceiling to be aligned with the centers of the 3/8-inch pilot holes drilled in the cabinet.
Lift the cabinet into position. Slide the wood lags into the pilot holes and pound them into the ceiling pilot holes with a hammer. Tighten the lag bolts firmly to the ceiling joists until the cabinet is tight against the ceiling.