Measure for the distance away from the wall. A minimum of 10 inches is best, but it'll depend on the size of your hangers. If there is a shelf above the rod, determine the vertical distance from the rod to the shelf; two inches should be suffice.
Pre-drill a hole for the bracket screw using a 1/4” drill bit. Attach the round-bracket to the wall using a 2” wood screw. Repeat the process on the other side of the closet for the u-shaped bracket.
Measure the distance from bracket to bracket. Then measure and mark the closet rod at that measurement then cut the rod to size.