Viruses cannot appear spontaneously on a PC. The only way to get a virus infection is by allowing infected software into the PC. There are a number of general precautions you can take to avoid virus infections.
You should be aware that more connections mean more risk. A standalone PC with a stable software base has much less chance of becoming infected by a virus than a PC shared by multiple users and/or connected to a large network.
Pirate software is dangerous. While infections from 'shrink-wrapped' software occasionally happen, they are extremely rare, but software which is copied from another PC or is obtained illegally, whether by downloading from the Internet or purchasing at a street market, has a much higher chance of being infected.
It is important to take regular backups and keep these over a period of time. This won't prevent viruses from attacking your system, but it will make it much easier to restore your system and recover lost data if this should be necessary.
It is important to control access to your PC. An open access PC used by dozens of people is much more prone to virus infection than one on an individual's desk, as you can never be sure that all users will be careful about what they download or import onto a machine.
Next: Removable Media