Instructions are based on Ubuntu 16.04 but works just the same on newer versions: https://retropie.org.uk/docs/Debian/