I have the (maybe wrong?) preconception that we only vaccinate against viral diseases, and that there can only exist vaccines against viruses. I think the idea comes from the idea that only for viral diseases are you becoming immune after contracting the disease, not for bacterial. The question Is there a vaccine against the plague (Yersinia pestis)? made me think that I don't really have a justification for that, seeing that the mechanisms for combatting viral diseases and bacterial diseases should be the same (is that right?).
So, is it possible to vaccinate against bacterial diseases? Do we have existing vaccines for any bacterial disease?