How to perform CPR on an unconscious person?

by unconscious i hope you mean unconscious-not breathing, as it will be fatal to do CPR on a breathing casualty.
any way for an adult unconscious not breathing: you should follow your DRABC (danger, responses, airways, breathing, circulation/CPR).
once you've checked for danger, you check for responses from the casualty, call for help, check for breathing, send someone to get an ambulance and an AED (defibrillator), you should then carry on starting with chest compressions at a depth of 5-6cm and at a rate of (30/2). with help this should be maintained for 6 cycles/2mins, without help; 3 cycles/1 min and then go for help.

for child the same however you start off with 5 initial rescue breaths before going onto 30:2, whilst also using only 1 hand, and a third the depth of adult compressions.

for infants the same as child, however using 2 fingers and when going for help the infant should be carried with you.