setup for rope climb?

best/safest way to hang a 2" rope on a 4"by 12"wood beam?

Hitch knots are strong and simple.  If you plan on using both ends for climbing or pullups, a cow hitch will work. If you want to only use one end, and be able to easily undo the knot with the other, try a highwayman hitch.  And if you don't have access over the top of the beam, you can use a thick eyebolt.