Really, it was very hard to keep fruit from going bad, even when dried it could mold in the heat and humidity of an ocean voyage. That's why Captain Cook was so pleased with sauerkraut on his voyage: it kept well and prevented scurvy.
The rest is pretty straightforward: salted meat in barrels, flour or biscuits safe in barrels, buy fresh provisions when in port or hunt and look for fresh provisions on islands, keep some live animals on the ship for slaughter , or for eggs.