One way of making a vaccine for a virus is to modify (attenuate) the virus so that it no longer causes an infection when it enters your body. This could be achieved by growing the virus in a special way in a lab. You could also kill the virus and inject the dead virus into the body.
It is also possible to inject a person by inactivated toxins so that the body can build up an immunity to the toxin to prevent the virus causing a severe reaction.
Peter has given great examples of how we create vaccines. For both vaccine and cure development, we can take a look at the genetic sequence to help. The sequence can help us predict which parts of the virus genome codes for the important proteins involved in virus-host interaction and reproduction. We can then design vaccines and treatments to target these. We can also identify area that undergo a lot of mutations (often known as hypervariable regions) which we might want to avoid targeting, as the sequence and therefore resulting proteins will quite possibly change, and with the result that the designed vaccine or treatment will not work for very long.