in the posts above.
For normal parking, park where it is level or uphill. Don't park where gravity will roll the bike forward. I come to a stop in first gear, put down the side stand (the bike shuts off), let out the clutch and roll forward to take up driveline slack, and then lean it over onto the sidestand.
(Don't forget to turn off the ignition key or you'll get a dead battery, DAHIK
For a train or ferry: if you have tie down points and you expect a bit of a rough ride, put the bike on the side stand in gear. Use one tie-down on the centerstand side of the bike and take up the slack in the tie-down. Use another tie-down on the other side of the bike and tension it so the bike's weight is pulled off the sidestand and the bike's suspension is compressed a little. Taking some weight off the sidestand where a rough ride is expected may prevent damage to the side stand.
If there are no tie-down points but you can park next to a rail, put the bike on the side stand in gear, and tie the bike to the rail.
For a rough ride the bike on the sidestand is less likely to damage things than having it on the centerstand where the center stand is taking all the bike's weight. A long bouncing ride with all the weight on the center stand just might break something. Using the sidestand puts more of the bike's weight on the suspension, the key is just to keep it from falling over, and minimizing risk of damage to the sidestand.
A bungee cord, velcro, or electrical tape on the front brake lever is a great idea regardless of the tie-down method.
Whether using the side stand or centerstand, running a line around the stand and through the front wheel to keep the bike from rolling off the stand is also a good idea.