Skip to content

Server Setup

Allexio edited this page Dec 12, 2024 · 13 revisions

Prerequisites

Docker is a neat utility that allows you to run instanced servers for anything you want. This allows you to then manage your instance very easily.

If you have a linux machine, chances are you have docker pre-installed. On windows, you will have to download it separately.

I recommend using docker via itzg's Minecraft docker image.

This setup guide assumes that you have:

  • Docker
  • Docker Compose functionality (may or may not be included in your Docker install)
  • Access to your server via ssh or any kind of CLI (command line interface)

Dockerfile (docker compose)

Here is an example dockerfile that should work out of the box:

version: "3"

services:
  mc:
    image: itzg/minecraft-server
    ports:
      - 25565:25565
      - 24454:24454/udp
    environment:
      EULA: "TRUE"
      VERSION: "1.20.1"
      TYPE: MODRINTH
      MODRINTH_LOADER: FABRIC
      OPS: "[REPLACE WITH LIST OF OPS]" # update this or remove it if you do not want to manage OPs via the Dockerfile
      WHITELIST: "[REPLACE WITH LIST OF PLAYERS]" # update this or remove it if you want your server to be public
      RCON_CMDS_STARTUP: |
        function mt:settings/enadis_sound
        function mt:settings/rare
        function mt:settings/disable_c
        function mt:settings/low_prog
      MEMORY: "5G"
      MODRINTH_PROJECT: cinnamon
      MODRINTH_VERSION: 2.0.4
      VANILLATWEAKS_SHARECODE: ilFuDN
    tty: true
    stdin_open: true
    restart: unless-stopped
    volumes:
      # attach a directory relative to the directory containing this compose file
      - ./data:/data

Let's go through this line by line:

  • image: itzg/minecraft-server - The docker image I am using, I use ITZG's image, which I really recommend, you can find documentation on it here.
  • 25565:25565 - This is for the game's port. If you are using a custom port you will need to update this line to reflect this.
  • 24454:24454/udp - This is for the voice chat mod. You can change the port to use in the mod's config file, just don't forget to change it here as well.
  • EULA: "TRUE" - You accept the Minecraft EULA
  • VERSION: "1.20.1" - Your MC version, this modpack is for 1.20.1 only (for now™)
  • TYPE: MODRINTH - I host my modpack on Modrinth
  • MODRINTH_LOADER: FABRIC - It is a Fabric-powered modpack
  • OPS: "[REPLACE WITH LIST OF OPS]" - You can insert a list of OPS here, or remove the line entirely and simply add OPS in game through the /op command
  • WHITELIST: [REPLACE WITH LIST OF WHITELISTED USERS] - You can insert a list of players that will be allowed on your server here. Alternatively if you want to host a public server just remove this line.
  • RCON_CMDS_STARTUP: - Commands that must be run on server startup
    • function mt:settings/enadis_sound - Disable the global sounds from legendary Mine Treasure chests
    • function mt:settings/rare - Make Mine Treasure chests spawn at the lowest chance
    • function mt:settings/disable_c - Disable Mine Treasure common chests (this is to avoid spam - even on lowest chance they are too common)
    • function mt:settings/low_prog - Make the loot progression for Mine Treasure slower
  • MEMORY: "5G" The amount of memory you are allocating to your minecraft server, this will mostly depend on the number of players you have. This modpack was tested to run very well with 10-20 players with 5GB provided.
  • MODRINTH_PROJECT: allexio-create+ - The ID of the modpack you want to use
  • MODRINTH_VERSION: 1.0.0 - The version of the modpack you want to use - don't forget to update this
  • VANILLATWEAKS_SHARECODE: ilFuDN - I add a few vanilla tweaks to my server, this is entirely optional, but I recommend using it.

Running the server

  1. Copy the above contents into a file named compose.yml
  2. Modify the contents as needed:
    • Update (or remove) the OP list
    • Update (or remove) the whitelist
    • Change the modpack version (if needed)
  3. Make sure you are in the same directory as your file
  4. Run the following command: docker compose pull - this will download all the needed files so that you can launch your server
  5. Run the following command: docker compose up -d (the -d is to run it in the background)

... and you should be good to go!

First time run of the server

You can skip this section if you used the dockerfile with the commands included

When you run the server for the first time, I strongly recommend you:

Use the /function mt:settings command to:

  • lower the amounts of Mine Treasure chests that spawn.
  • completely remove common chests
  • set the probability of finding a chest to the minimum value.
Clone this wiki locally