notes/Setting up a Minecraft server.md
2023-07-23 08:27:03 -06:00

28 lines
1.2 KiB
Markdown

# Preamble
*This guide assumes some basic knowledge of Linux and package managers.*
At minimum, a minecraft server requires Java, the [minecraft server jar](https://www.minecraft.net/en-us/download/server) or an alternative server (spigot, lithium), and the ability to port forward and allow programs through your firewall.
# Installing Java
As of 2023-07, Minecraft requires Java 17 to run version 1.20.1. You may need to look for a later version. Don't install the default version of Java in the repos of your chosen distro, it's very often out of date, and probably won't work with minecraft. I personally like
This enables minecraft to run in the background, restart if it crashes, etc etc.
In `/etc/systemd/system`, place this file and tailor it to your liking.
```
[Unit]
Description=Minecraft Servre
# I don't know what these mean I'm getting them from here:
# https://gist.github.com/dotStart/ea0455714a0942474635
Wants=network-online.target
After=network-online.target
[Service]
# If wanted, you can set a particular group or user to run the service under
# User=foo
# Group=bar
# This command is run when the service is started
|ExecStart=/usr/bin/java -Xmx8G -Xms3g -jar /path/to/server.jar --nojline --noconsole
```