Where depends on the boat and space available, hopefully close to the loads like the starter for short runs of heavy cables.
How depends a bit as well. On a fiberglass boat you can glass a flat support in with raised edges to act as a catch tray for spills. The batteries can be strapped to the tray and either totally covered or just the posts.
Or you can buy a suitable battery box and strap it to the tray. The heavy white ones are the best but the standard black ones are fine for the start battery.
Or you could build a box with lid and glass it in place. Any wood used should be epoxy and glass covered.
Living aboard in Victoria Harbour