Yes, you can have them without carpets. The adult beetles fly, and, just like with pantry moths and flour or cereal and that kind of thing, they can ride in on things even new from warehouses and such. As a knitter, I once got some yarn shipped from a company that was already chewed on a little (they replaced it free).
They're very different species so I'm sure prevention is also. But I've never tried to get rid of moths...I don't use mothballs or anything as toxic as that. The last moth problem I saw was years ago when I lived elsewhere, so hasn't been an issue for a while!
Other than keeping items clean before you store them (they tend to like wool that has been worn/used), I don't know what to recommend to prevent them showing up. Thorough vacuuming, including of all crevices, is one thing to do. I have also put bars of soap in my tubs of yarn to throw them off the scent, but like with lots of these things, there are all kinds of remedies that who knows if they actually work...see what the internet recommends nowadays.