I know there are many, many scripts for this.
Nevertheless, a lot of them give trouble, so I collated all the errors/glitches I’ve seen into these 2 scripts, and also created VM’s which are downloadable.
The idea is to create, from zero, a bare metal setup that has the latest ERPNext on a fully up-to-date OS.
They are liberally commented and may have some useful info in them. I have tried to credit anything I looked up, but if I have missed any such credits, please let me know and I will add/fix those.
Hopefully, they are useful.