I started 8-10 weeks before the hike. In the first weeks I did 4-5 times a week 1 hour of fast walking. Started with 5-6 km/hr and continued with up to 7-8 km/hr. I was always wearing the new hiking shoes to brake them in. In the last 2 weeks I walked with a 12 kg backpack about 3 times a week and also did one longer trip of 15 km with a fully loaded backpack (17 kg).
There are other ways to get in shape this one worked for me, and it really paid all the dividends. I hiked in a south to north direction which is more difficult since the first day starts with a steep climb with an accumulated climb of approx. 1000 m (~3300 feet). From the north it is an easier start.