Position it properly in the opening. Make sure it is centered in the frame.
Use finishing material such as a piece of drywall to adjust the door. The finishing material will act as a spacer against the studs of the trimmer. If you haven’t installed the finish floor yet, raise the side jams to the right level. You can use blocks to do this. Doing so will prevent you from having to cut the bottom of the door.
Check if the door fits properly into the opening one more time. Check if the jams are plumb from front to back and in each side. Place a set of tapered wooden shims between each of the jams. This will hold the door in place.
You can then start to nail the jams. Do the lower hinge first. Nail through the jams and shims an inch into the stud. Ideally, you should use 10D finishing nails. Place the nail at the area where the stop molding would cover it. Perform the same steps on the middle and top hinges. Ensure that the jam above the doorway is straight and level.
Shim the opposite jams found at the similar locations. Do not nail the area where you would put the latch.
Take off the bracing of the door. Install the lock set. The procedures in setting up the lock vary from one style of door to another.
Cut off the shims, and nail the threshold between the door’s jams. The threshold should rest firmly on the subfloor.