Besides getting shots, you can lower your risk of getting bacterial pneumonia by doing these things:
Wash your hands regularly, especially after you go to the bathroom and before you eat.
Eat right, with plenty of fruits and vegetables.
Get enough sleep.
Stay away from sick people, if possible.