you typically bolt on the rear derailleur without the chain on the bike. Once it's bolted on and the chain is on, you shift to the highest gear, set the appropriate stop for the derailleur, shift to the lowest gear and set the appropriate stop, and then adjsut the indexing at the shifter.
actually, you should adjust the indexing on the derailleur first. Use the barrel adjuster where the cable goes into the derailleur. You can further adjust it on the shifter if you choose, but start with the barrel adjuster on the derailleur.
I always started by setting the limits first. I forgot to set the limit for higher gears once and the cage went right into the spokes. Bent that cage, i did mange to bend it back though. After the limits then, without the chain, you deal with cable tension and whatnot so that when you shift into a gear the mechanism is right below it. Install the chain and fine tune using barrel adjusters.
High & low limits first, then indexing. Work big larger issues to smaller issues, weeds problems out without much back tracking. Also, check here for more info. If you don't have the housing and cable installed either, links at the top of that page should provide some good help.