The best way to prepare for a big hike is with smaller hikes, but generally speaking it’s completely impractical, as almost no one has the amount of time needed to hike enough to see a progression of physical ability. So InB4 anyone even suggests it.
Best bet are the obvious ones: cardio, endurance training, focus on legs. I noticed more improvement from strength training at higher reps than I did from medium intensity cardio.
I stretch every day, in the evening after work or the gym. While stretching after a workout might be more effective than before, the most important thing is to stretch regularly and often. Keep them basic; there are tons of retarded variations out there. So when googling, search for “basic hip flexor stretch” and look at several to see what a “normal” stretch looks like instead of some off the wall dumb shit.
My leg stretches are just 5 things: quads, calves, groin, hip flexors, and hamstrings. But that’s me. You might have problem areas or find that to be too much.