If you have a spare system around, try knoppix. Knoppix is a Live DVD based on Debian linux that can be installed to run from a hard drive or a flash drive.
It's pretty useful for systems without hard drives, you can just run it from a flash drive. Unfortunately, most flash drives write fairly slowly so it's best to run it from a local hard drive.
I like to use the boot cheatcode "knoppix64 tohd=/dev/sda1" which will copy the knoppix dvd to free space on partition sda1, without overwriting other files on the partition. You still use the dvd to boot, but it will auto find the knoppix files you've copied or you can use "knoppix64 fromhd=/dev/sda1" to specify it manually.
If you have enough memory, you can have the livedvd copied to ram and execute only out of ram memory with "knoppix64 toram"
You can get knoppix from http://knoppix.net
Knoppix has a remarkable collection of software installed, but one thing it's missing is mame.
Being based on Debian, we can install Debian packages on Knoppix. Knoppix9.1 is based on Debian Bullseye.
We can install Debian's packaged version of mame. (most recent stable version is mame 0.228) which is almost a year old now.
Two packages are needed: mame and mame-data. Optionally you can get mame-doc and mame-tools.
You can search for packages at http://packages.debian.org
for "mame" and locate the packages that way:http://http.us.debian.org/debian/pool/main/m/mame/
Also needed are two packages to parse xml and for the lua console:
Note that Knoppix is based on i386 architecture, so you have to get the i386 packages. Yes, it's not 64 bit packages but it does run under a 64 bit kernel with "knoppix64" on boot.
wget the files, then after booting knoppix, just run "dpkg -i *.deb" and it should install mame 228.
Note that if you've copied the knoppix files to the hard drive with the cheatcode "tohd=/dev/sda1", you can save files in the directory "/mnt-system" which is where knoppix is mounting its system files from. (/mnt-system -> /media/sda1/KNOPPIX)
But what about more recent versions? Debian packages 238 but it relies on some more recent libc dependencies so it won't run on Knoppix 9.1.
However, you can compile the latest mame (tried with mame 239) under knoppix 9.1. Knoppix9.1 has gcc 9 installed as well as git.
First, you will need some packages:
If you put this list into a file you can use "wget -i <filename>" to download the file list in <filename> or just wget each one manually.
Then you can use "dpkg --force-depends -i *.deb"
We use force-depends because we haven't grabbed all of the dependencies.
Download the source zip from mamedev.org and extract it.
then edit the makefile with "nano makefile"
locate the line with #PTR64 = 1 and change it to just "PTR64 = 0"
because we are going to build for i386 which is not 64bit.
You may need to set the line (I don't think you have to though)
QT_HOME = /usr/lib/i386-linux-gnu/qt5
Then you can compile with "make -j4" and when it's done you should be able to run mame.
Knoppix9.1 is super useful, I like to use it on old laptops that don't have hard drives. It's super handy for testing hardware, and has lots of utility programs like "hardinfo".
Another thing you can try is "sudo apt install mame mame-data"