"How do I get a vaccine for bacterial pneumonia?"
There is a common vaccine called pneumococcal polysaccharide vaccine (PPV). You can read more about it on
this CDC webpage. Commonly given to the 65+ year old crowd. Just note that the bacterial strains covered by this vaccine aren't the only bacteria that can cause secondary bacterial pneumonia, so it's not a foolproof protection against a repeat of a Spanish Flu-type pandemic.