How should a civilian greet a soldier?

Just say hello sir/madam.

And thank them for their service to our country.