Break the chain, measure the new chain so it just fits tight around the largest rear cog, and the largest front chainring (without threading it through the rear derailleur for measuring purposes), and leave two extra links.
Take the cable out of your old rd. Unthread it from the frame (derailleur hanger). Put grease on the threads of your new rd. Thread it into the derailleur hanger. Be sure to get the derailleur angle adjustment screw above the stop that is forged into the derailleur hanger, so it rests on it when you let go.
Thread the cable through your new rd and tighten. Now you put the chain on. Adjust rd stops so its range goes from smallest cog to largest on the cassette. Put the wheel in and check shifting. Twist barrel adjusters for perfect indexing. Get on it and ride!