How to Play Arcade Games Using MAME on Linux.
Contents
Are you looking to take a trip down nostalgia lane and play some old arcade games on your Linux PC? Currently the best way to emulate any arcade cabinet is to use MAME on Linux. This software is a multipurpose emulator that allows you to run various types of arcade cabinet games on any PC. It is open source, has a ton of features and is very reliable.
Note: SamaGame.com in no way encourages or condones the illegal downloading or distribution of ROM or BIOS files for MAME. If you choose to install MAME, use your own game ROMs and BIOS files that you have backed up on your PC, legally.

Install Mame on Linux
There are multiple implementations of the MAME emulation software. For most Linux distributions, it will be easy to grab and go. For other Linux distributions, you will need to compile the software manually.
The software runs as a full-screen application that users can interact with using a mouse, making it perfect for those looking to turn a Linux PC into a gaming cabinet. To install the software, open a terminal and do the following:

ubuntu
Mame is available for Ubuntu, but users cannot install it without first enabling additional software repositories. The one that needs to be activated for the Mame emulator is “Universe”. To enable the Universe software font, open a terminal and enter the following:
sudo add-apt-repository universe

The above command tells the system that it is okay to use Universe as a software source. The next step is to update the system and update the cache to reflect the changes we made. This is done with the apt update command.
sudo apt update

With universe enabled, Mame will install on Ubuntu:
sudo apt install mom
Debian
sudo apt-get install mame

ArchLinux
Mame is available for Arch Linux, but users will need to compile it for it to work. Here’s how to do it. First, open the terminal and use it to install the various dependencies that the software needs in order for it to build correctly.
sudo pacman -S base-devel git sdl2 gconf sdl2_ttf gcc qt5
Using the git tool, get the latest version of the Mame source code.

git clone https://github.com/mamedev/mame.git
Enter the cloned Mame directory using the CD command.
cd mom
Finally, compile the software.

make
fedora
sudo dnf install mame
OpenSUSE
sudo zypper install mame

Other Linux
Mame can be easily compiled on any Linux distribution without any problems. The only requirements are basic build tools like GCC, SDL, and the framework. The and the developer also has .
Configuring Mame
Mame is not like the other emulators on Linux and depending on how you install it, it takes a bit of time to get started. If you have installed Mame via a package manager (Ubuntu, Fedora, etc.), open a terminal window and enter: mame
This will run the emulator. Alternatively, try the quick launch menu. Press ALT + F2 on the keyboard, then type “love me” and press enter. It should open the full screen emulator app.
Note: the Mame emulation tool is also in the app launcher (if you installed it and not created it).
On first launch, the emulation tool will refuse to work. This is because there is no ROM (or BIOS for the many arcade cabinets) to work with. To add game ROMs to the program, open a terminal window and get a root shell:
sudo -s
Next, navigate through the terminal to wherever your ROM files exist on your PC.
cd /home/username/my-example-folder

Copy the ROM files from the folder to the ROM directory.
cp -R /home/username/my-example-folder/* /usr/local/share/games/mame/roms
Compile MAME from source instead of installing via a binary package? If so, the above instructions will not work. Do not gain root in the terminal. Instead, you’ll need to do the following to make it work:
cp -R ~/my-example-folder/* ~/mame/roms

Every time you want to start the emulator:
cd ~/mame ./mame64
Alternatively, open the file manager, navigate to /home/username/mame, right click on mame64 and run it.
Please note that no Arcade ROM file will function properly without the proper BIOS files. For legal reasons, it is not okay to simply distribute these files on the Internet. To obtain these files legally and place them in the /usr/local/share/games/mame/ or /home/username/mame/roms directory
launch a game
A game will only start on Mame if it has the proper BIOS files. For example: To run Metal Slug 5, you would need the NeoGeo BIOS files as well as the ROM for the game itself. Place the individual NeoGeo BIOS files inside the Metal Slug 5 folder.
You may need to repeat this process for each game to work as there seems to be no BIOS root directory to work with.
When the files are where they need to be, simply launch the Mame app and use the menu picker to select a game. From here, a warning message appears.
configure a controller
Configuring controller inputs for players in the MAME emulator begins by selecting “Configure General Inputs” at the beginning. This will open a menu, with a list of controller configuration settings for players 1 – 8. Plug in a gamepad and select the player you would like to configure.
In each individual menu, the user must assign buttons to the player. Scroll down the list, select the control key, and press the enter key to remap.
When the remapping option starts, press the desired button on the gamepad, keyboard (and etc.) to assign the specific buttons to the current player. Note that you will need to do this for each gamepad and player.
insert coins
Considering that MAME stands for “multiple arcade machine emulator”, the message “insert coin” appears frequently. Don’t worry, unless you install a coin reader and configure it, the software won’t ask you for quarters. Instead, you’ll need to press a button to simulate a coin being inserted.
Coin controls are defaulted to 5-8 on the number row. Press one to insert it and start the game. Also, the player start buttons are 1-4 (one button for each player).