Setting up a NeoForge Minecraft server on a headless Linux server

We recently became interested in Minecraft again, n we figured we might wanna host our own server (which's sth we hadn't ever done yet, fwiw). We like the Aether mod a lot, n that doesn't run on Fabric or Quilt, so we hada set up a server using NeoForge (the original Forge seemsa be dead). Turns out tho, there's no easily findable guides online on howa do this? They might, generally speaking, assume ya got an environment where ya can easily run a GUI. We got some help from friends n then figured out some stuff on our own, n did manage after all, so't seemed like a good idea putting the stuff learned in the process on here.

Firsta all, ur gonna need OpenJDK 17 (las of 1.20; later NeoForge/Minecraft versions might use later JDK versions). On NixOS, ya could use the jdk17_headless package for that. Then, grab the installer JAR for the Minecraft/NeoForge version ya want from the NeoForge website. Ya prolly wanna make a user for running NeoForge, too, assuming ya got root on the machine ur gonna run't on. Once that's done (n ya've switcheda the user ya wanna run things as), ya can call the JAR w java -jar. From the directory where ya wanna store the data, run w the --installServer flag. E.g. for the current stable version, the full command'd be java -jar forge-1.20.1-47.1.96-installer.jar --installServer (for other versions, just replace the filename in that command). N that's't, basically. Put ur mod JARs in mods/, n configure them thru files in config/ (default config files should be put there when ya start the server w the corresponding mod(s) for the first time). Ya prolly also wanna change the file in the root dir as needed; Minecraft wiki documents all the options. There should be a script in the root dir, too, but it's just a single command basically (remember passing nogui as an argument when running headlessly), it's entirely possiblea run that outside that script ofc, e.g. just put that line in a systemd service's ExecStart. Ya can check out our systemd service config on Codeberg, we also figured out some syscall filters n such.

N now that's really it. Hope this helps <3