Measure the dimensions of the doorway. Purchase a bi-fold door that will fit within the doorway after the installation of a 1-inch-thick frame all the way around or purchase another size of door and adjust the thickness of the frame board to reflect this.
Calculate the width of the doorway and cut two 1-by-2 inch boards to fit this measurement. Position each board in place with its large surface against the top and bottom of the doorway and drill a hole every 12 inches through the board and into the doorway. Set a 3-inch wood screw within the hole and attach the board to the doorway.
Measure the distance between the top and bottom frame boards and cut out two 1-by-2 boards to fit this measurement. Set the boards between the top and bottom frame boards with their large sides against the sides of the doorway. Set a level against the side of the boards and adjust them until they are straight. Hammer shims between the frame and the doorway if necessary and break off any sections that stick out from the frame.
Drill holes every 12 inches through the side boards into the doorway. Attach the boards in place with 3-inch wood screws.
Set the rails in place on the top and bottom of the frame and attach them with the included screws.