As a general rule, the lighter you go the harder it is to extract the coffee. The more expensive the equipment will need to be. To make good espresso from light roasts you can benefit from a machine which can handle flow profiling as the puck is so unstable at lower roasts that consistency becomes very difficult.
So you pick a medium roast, a good quality grinder (although even in the expensive range, different types and subtypes of burr will produce different results) and a quality machine which can hold a stable temperature.
Next, it's important to keep it all consistent, weigh the coffee, weigh the output. Things like WDT[0] can help get an even distribution of coffee in the portafilter, although recently people have started looking at shaking the coffee grounds as a better option, although there's some limited research on this. To go the extra mile, RDT[1] can help increase grind consistency, and so can freezing the coffee beans (although usually you want to single dose the coffee to avoid condensation on your frozen beans slowly causing the moisture content to increase). I also use paper filters below and above the puck, as well as a mesh filter on top of the paper filter, this helps distribute water, prevent clogging, and improve reliability (it's honestly quite a surprisingly noticeable difference).
Now for dialling in: You pull a shot, you taste it, as a general rule of thumb if it tastes empty and sour you should pull a longer shot (higher output weight), if it tastes bitter and/or salty then you should pull a shorter shot (lower output weight). Once your flavors are balanced you can adjust the grind to increase or reduce the overall concentration to your taste.
For medium roast I normally aim for 1:2.5 ratio (15g of ground coffee in, 37.5g of liquid coffee out) and adjust from there. The timing is a complex topic which depends highly on what you're trying to do, turbo shots naturally run very fast, blooming shots naturally run very long. You should try to get the machine to run between 20 and 35 seconds but if it tastes better if you go longer/shorter then don't blindly stick to this.
It's difficult to get good espresso reliably, and especially so when you are doing it at home and don't have a day's worth of customers to offset the cost of a wasted few shots. But it's possible. You also have to start over every time you get new coffee beans.
For reference, my setup is a Gaggia classic modded with flow profiling (gagguino mod) with a niche zero conical burr grinder. I live far enough away from London that Brita filtering the water produces good quality results, but some people may want to distill and re-mineralise water using a recipe for maximum consistency.
[0]: https://www.baristahustle.com/weiss-distribution-technique/ [1]: https://www.beanground.com/ross-droplet-technique/