Stand the door unit in the opening, so the casing is lined up with the interior edge. Leave the doors closed.
Hold a level along one vertical edge of the unit. Shim around the sides, between the casing and the edge of the opening, until it reads level and plumb.
Open the doors, cutting off the bindings --- holding them closed if necessary. Open them widely enough to access the interior surface of the casing around the doors.
Secure the casing to the opening, driving in screws outward through the casing into the frame. Put them every foot or so up and down each side.
Use a razor knife to cut off the overhanging shims.
Remove the middle screw from each hinge, using your screw gun. Replace it with a 2 1/2-inch screw, driving it all the way through the casing and into the surrounding frame.