I have been seeing a lot of users reporting the "500 internal server error" recently, but I'm not sure what is going on as I have not had time to read any of the many threads on these forums. You may want to search the Apple forums for this issue as I have seen dozens of threads over the last two weeks.
In general you want to perform a clean install of the OS by first erasing the whole physical drive before installing the OS whenever you acquire a used computer. I would do this even if the previous owner has already done it just to be 100% sure it is done correctly. I suggest booting into Internet Recovery Mode using Command + Option + R to boot to the online macOS installer. What macOS installer you get with this key combination will depend on the highest OS previously installed and whether Apple will boot to any installer other than the oldest one which shipped with the Mac.
Make sure to launch Disk Utility after booting into Internet Recovery Mode so you can erase the whole physical drive. How you do this depends on which version of the macOS installer you get. If you boot to the macOS 10.13+ installer, then you will need to first click on "View" within Disk Utility and select "Show All Devices" so that the physical drive appears on the left pane of Disk Utility as recent versions of macOS now hide the physical drives from view by default. For macOS 10.13+ erase the physical drive which should be called something like "Apple SSD ...." as GUID partition and APFS top option. If using a macOS 10.11 or 10.12 installer erase the physical drive as GUID partition and MacOS Extended (Journaled). If you are booting to a macOS 10.6 to 10.10 installer, then you will need to partition and format the physical drive using the instructions in this article:
https://www.owcdigital.com/assets/support/support-formatting-and-migration/Mac_Formatting_6-10.pdf
If you can download the macOS installer while booted into macOS, then you can create a bootable macOS USB installer using the instructions in this Apple article (which also includes links to the various macOS installer downloads):
https://support.apple.com/en-us/HT201372