How do I stop food cravings in order to do a fast?

Focus on benefits. Typically people feel overall more alive and energetic when eliminating processed foods and simple carbohydrates. Focusing on how good you feel, coupled with being sure that you are receiving enough protein and complex carbs (steel cut oats, vegetables) and water will reduce the cravings for candy/cake/cookies/ice cream/chips/soda, etc. Entering into your fast and post fast diet will be easier.