First, settle any outstanding debt. If you owe money on collection accounts, charge-offs and/or judgments, make payment arrangements and get these accounts paid promptly.
Next, begin rebuilding your credit. If you have current accounts with good payment histories, or even some previous late-payment-blemishes, make sure you continue to pay those accounts on time. If you do not have any existing credit accounts then you'll need to establish several in order to create a viable credit history.
I have found that CONSUMER ACTION is an excellent resource for objective advice on all things credit related. You'll find free and sincere advice on everything from settling collection accounts to rebuilding credit to building credit from scratch on their website. http://consumer-action.org/
Beware of anyone offering to "repair" your credit! The Federal Trade Commission issued a stern warning last year that such offers are scams. Find more from the FTC HERE. http://www.ftc.gov/bcp/edu/pubs/consumer/credit/cre13.shtm
The best way to buy a home is to have a decent credit history combined with sufficient Income and Assets for a home purchase.
The best way to have a decent credit history is to settle negative outstanding obligations and pay all your bills on time for at least two years.