A lot of these trails pass through towns, or go close enough to them that you can stock up every few days. There are also "trail angels" who wait on the trail to supply food, water, and other essentials to hikers, usually just out of the (abundant) goodness in their hearts.
many have towns or outposts every 5-ish days of hiking (~50 miles) to re-up. you can purchase from store or strategically time all your packages on your route.