Conventional wisdom is that it is always better to buy than to rent, and that a house is always a good investment.
That may not be quite true.
There are lots of great reasons to buy, but probably almost as many not to. And buying as an investment is another ballgame altogether. There can be issues with tenants (if you intend the property to be an income property), issues with zoning and building restrictions, and costs related to the purchase and sale, to name a few. Many real estate investors find it very profitable, but it is not for everyone. For a (somewhat snarky) look at why you should not invest in real estate, check out this list from Lifehacker.