No one has suggested the way that I used to do it, so I'll throw that idea out there, even though I don't do it that way anymore:
at each level, roll for hit points. Keep the roll, or roll a second time, and (here's where it's different from others) keep the average of the first and second rolls. (Round up.) The player gets a chance to roll high, and a chance to remove some of the sting of rolling low, but that first low roll still has a significant effect.
But I don't do it that way anymore. I had an epiphany in which I realized that the Toughness feat gives you +3 hit points, so if you let hit points be established randomly, you're giving out the equivalent of a portion of a Toughness feat to anyone who rolls above the norm, and penalizing anyone who rolls below the norm. That's just ... wrong. You wouldn't let a spellcaster roll d6 to determine how many new spells she can cast, would you? You wouldn't give a character a 1 in 4 chance at each level of gaining +1 to an ability score of choice, would you? Or a 1 in 3 chance at each level of gaining a new feat? But this is the sort of thing that goes on with hit points.
End of rant. What I do now is give everyone average hit points, rounded up. That doesn't mean a fighter gets 6 per level; it means a fighter gets 6 at first level, 5 more at second level, 6 more at third level, and so on.
YMMV.