You doctor may give you an antibiotic to take. Also you need to keep the area super clean. Sometimes you doctor will give you as part of the treatment a solution that is antiseptic which may need to be diluted. It's easy to try to prevent hair follicle infections by exfoliating your skin often.
Depending of the size of the affected area, the treatment could be different, there could be used either some local antibiotic cream, or oral pills, but it's a doctor's decision.