Avoiding ransomware is much the same as avoiding other types of other malware.
Always run a good antivirus utility and keep Windows and browser-related components (Java, Adobe, and the like) updated. Keep your browser clean to prevent adware invasions that could lead to malware infections. Always, always be wary of unexpected email attachments and spam. (CryptoLocker spreads via .zip files sent as email attachments, for example.)
And just to beat this dead horse one more time: Always have a good backup system in place, just in case your PC does become infected and you can’t recover your files. Yes, it’s that important.