Common courtesy is a must. We take it to an extreme. Graham is not allowed to approach people or dogs without my okay. I also pull him off the trail and have him in a down between my legs (safe command) whenever anyone is approaching us on the trail. Sadly, most people don't know it's a courtesy thing and automatically assume he is aggressive despite the fact that he is off leash and I'm not holding him. It's amazing how many people don't know obedience when they see it.
The key is to practice all trail behavior over and over whether there are people around or not. That way they just get into the habit of being courteous. I have been able to take Graham off-leash in areas that are full of people and have him down on the trail or stand and wait until I can catch up. He usually drops into a down whenever anyone approaches us before I can even tell him to!
Always keep your pup in sight and under control. Above all, have fun! It's a whole new hike when you bring a dog along