Focus shifting or bracketing
One method to acquire the photos for Focus stacking is focus shifting or bracketing. Just focus on the nearest thing you want to have in focus in the final picture, take a photo shift focus a tiny bit, take a new photo, shift focus take another photo and so on.
In camera bracketing
Some newer cameras have the possibility shift focus or focus bracket automatically. A few can even stack the pictures in camera. Below is an example with an Olympus tough camera that can focus bracket and focus stack in camera.
Olympus tough 4. Stacked in camera. The small sensor and chromatic aberration can be very limiting. But in some occasions, the Olympus tough cameras are a good option.
Olympus tough – a stack of 30 pictures, stacked in Zerene Stacker. Ok for the Webb and for ID- purposes.
Bracketing with a tablet
For stationary objects where you have time to set up your gear, I recommend a tripod for stability and viewing connecting the camera to a computer, a tablet or a phone. For cameras that does not have automatic focus shifting/bracketing the lens can be turned by hand or perhaps more convenient controlled by the computer, tablet or phone.
For this picture of a Cladonia (cup lichen) I used a Canon 5D, Canon EF 100mm f/2.8L Macro IS USM lens, Benro tripod and a Samsung tablet.