Time and patience are the main cure, but there's a specific way to speed things up. Try feeding the rat from your hand - literally place a treat (raisins, a banana slice) on your palm and just sit nearby without making sudden movements. The rat will gradually understand that your hand is a source of food, not a threat. Hissing and bite attempts in the first few days after bringing it home from the pet shop are almost always a defensive reaction, not a sign of innate aggression.
When I was helping a friend set up a terrarium for his rat, it also acted aggressively for the first two weeks. We just put a glove (clean, with no laundry smell) in the cage and left it there - the animal got used to the human scent. At the same time, we offered treats through the cage bars. After about a month and a half, the rat was already jumping on his shoulder, completely tame. The key is not to shove your hands into the cage abruptly or grab it by force, otherwise the fear will just get worse.
Also make sure the cage is spacious enough, with hiding spots and toys. A bored and scared rat bites much more readily than one that's busy and feels safe. And yeah, young rats from pet shops often get scared - it's not their fault.