Minecraft server setup - Pachwenko/my-docs GitHub Wiki
Vanilla
Should be able to find another guide on this somewhere - I would recommend running papermc though as it is more performant than vanilla
FORGE
Download the installer from https://files.minecraftforge.net/net/minecraftforge/forge/
Run it in the folder you want your server to be in with java -jar installer-x.y.z.jar --installServer
Run the server using the generated .jar file java -jar forge-x.y.z.jar nogui
TODO: figure out pre-generation + installing modpacks