How do you install blocking in a straight line?
Toe nailing is usually the easiest (provided you're using an nail gun). 

If you want to get fancy, you could end-nail every other one, then use L-brackets for the ones in between (nail the bracket to the blocking so that and then nail the bracket into the studs):



                     |  |
                    +|  |
                    ||  |
                    ||  |
               +----+|  |
    +---------------+|  |
    |               ||  |
    +---------------+|  |
                     |  |
                     |  |