Hey! A friend recently asked me and a few other friends to play Minecraft, and I don’t know anything about hosting one, so why not give it a try? This page is mainly for writing down rough notes I had along the way, so I don’t forget about them :) . It is not meant to be a follow-along guide on how to set one up.
We first hosted it on my local machine via Docker and we all used ZeroTier to be on the same network (like Hamachi) then moved it to a VPS of mine. We ended up playing on a lightweight vanilla mod pack called SimplyOptimized then just added a few small mods on top. For that, a VPS with 2vCPU and 4GB RAM seems to be enough for 5 players playing at once.
Running the server
I used the Minecraft Server on Docker (https://docker-minecraft-server.readthedocs.io/en/latest/).
First, we tried a few Forge mod packs using the “Auto-download from CurseForge” method on the Minecraft image
- Roguelike Adventures and Dungeons 2
- Cottage Witch
To look for mods and modpacks, https://modrinth.com/ has a lot of them and the site looks nice.
- TODO but we had some issues of server failing to start as I think some mods are not correctly categorized as client/server, or that the client had missing mods that needs to be fixed manually
- Exclude client mods doesn’t seem to work
- then tried the “Manual CurseForge server packs” method which is deprecated but works, cause it takes the server modpack instead, which I guess guarantees that it does not have any client only mods there
some tips
- A friend of mine suggested to use paper mc as its more lightweight than the vanilla server with forge or fabric mod loader, but there wasn’t many mods for paper mc, so we went ahead with fabric instead.
- Set memory to 1-1.5 GB lower than a VPS’s limit, otherwise the Docker container can be killed due to excess VPS RAM usage.
- Set a max world size limit, so players don’t wander too far.
- Preload chunks of the Minecraft world using https://modrinth.com/plugin/chunky, so server has less work when players are exploring, but it does make the save file bigger.
- Can run some server commands from the cli using RCON
docker exec -i minecraft-server-compose-mc-fabric-1 rcon-cli
- some commands: to make someone admin
/op <username>
, to send a message to the world chat/say <message>
- to create a new world or regenerate one, use LEVEL and FORCE_WORLD_COPY ref https://github.com/itzg/docker-minecraft-server/issues/1649
- there is a config SETUP_ONLY, which is useful for using a modpack, but wanting to add a world generation mod, as normally, when server is created, it automatically creates the world as well
- this is useful for migrating worlds as well
- TODO add to onedrive things to do on join
- change leaves
- edit world map to display player icons
- disable inventory failed swap notification
- join party
Here is the docker-compose.yml file I have now.
services: mc-fabric: image: itzg/minecraft-server:java21 tty: true stdin_open: true ports: - "25123:25565" environment: EULA: "TRUE" TYPE: "MODRINTH" MODRINTH_MODPACK: "https://modrinth.com/modpack/sop/version/1.21-4.2.1" # Set it 1-1.5GB lower than host's limit. Ref https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/ MEMORY: "2700M" # Java jvm flags for better garbage collection USE_AIKAR_FLAGS: true # Minecraft version VERSION: "1.21" # False for cracked launchers to work ONLINE_MODE: "FALSE" # World settings # Unsure, but some evars e.g. LEVEL may need a full docker compose up -d to take affect, not just docker compose restart LEVEL: "terra" MAX_PLAYERS: 10 MAX_WORLD_SIZE: 10000 SPAWN_PROTECTION: 0 volumes: - ./mc-fabric:/data
Connecting to the same network (if server hosted locally)
TODO
Running the client
TODO