How to set up a Terraria server: a step-by-step guide
This guide takes you from nothing to a working Terraria server: choosing an operating system, running the server files, configuring it through serverconfig.txt, opening ports and the mistakes most often made on first boot. A vanilla install and a modded tModLoader install follow the same skeleton; where the two diverge is marked separately.
Before you start
- A server. Terraria produces one of the lightest workloads on this site: a vanilla world for a group of friends runs on 2 GB / 1 vCPU. What decides the requirement is not the player count but world size and mod list; a large modpack on a large world approaches 4 GB. The logic behind the calculation: how many vCPUs and how much RAM?
- A decision: vanilla or tModLoader? They are separate server programs and moving worlds between them is not seamless. Make this call before you install.
- A backup destination. A Terraria world is a single file; if it is corrupted, the world is gone entirely.
1. Operating system
Choose Ubuntu 22.04 LTS or Debian 12. The Terraria server needs no graphical interface and runs as a single process; the only effect of a template with a desktop installed is wasted memory.
You will manage the server over SSH. Key-based access and the hardening steps worth doing on day one: connecting to a server over SSH
2. Server files and starting up
The vanilla server files come with the game's official dedicated server package; if you use tModLoader, you download its own server distribution instead. In both cases the Linux binary is run directly and the configuration file is passed as a parameter:
./TerrariaServer.bin.x86_64 -config serverconfig.txtRather than leaving the server in a screen session, define it as a systemd service with Restart=always; when the machine reboots, the world comes back on its own.
If you use tModLoader, there is one critical rule here: the tModLoader version on the server and on your players' clients must match exactly, and so must the mod versions. A mismatch surfaces as a cryptic error while the player connects and leaves no trace on the server side. Pinning the modpack list and handing players the same list prevents most of the support tickets this game produces.
Servers that want administration tooling usually run TShock, which adds permission groups, admin commands and plugin support. TShock generates its own configuration folder on first boot, so start the server clean once before adding any plugins.
3. Configuring through serverconfig.txt
Every setting lives in a single plain-text file, read line by line. The fields that matter in practice:
world=/home/terraria/worlds/world.wld
worldpath=/home/terraria/worlds
autocreate=2
worldname=Server
difficulty=1
maxplayers=16
port=7777
password=
motd=Welcome to the serverThe line most often overlooked here is autocreate: if the file world points at does not exist, the server creates a new world and says nothing about it. When the path is mistyped, players land in an empty world while the old one sits on disk untouched. After setup, join once yourself and confirm the world you meant actually loaded.
When shutting the server down, do not kill the process — use the exit command in the console, which saves the world and shuts down cleanly. A hard stop that lands on a save produces a corrupted world file. The .bak file kept beside the world is your only chance in that case, but it does not count as a backup on its own; the full approach: server backup strategy
4. Ports
| Port | Protocol | Purpose |
|---|---|---|
| 7777 | TCP | Game traffic |
Terraria runs over a single port and over TCP; there is no separate query port. If you run several worlds on one machine, give each instance its own port and its own working directory. If you are on Datafex, port management is handled from the customer panel.
The most common first-boot mistakes
- A wrong `world` path with `autocreate` enabled. The server quietly generates a new world and players think they have lost their progress.
- Mismatched tModLoader versions. The player cannot connect and nothing appears in the server log.
- The process was killed hard. If that lands on a save, the world file is corrupted.
- The port was opened as UDP instead of TCP. The server runs but nobody can connect.
- The password written only in `motd` while the `password` field is left empty. The server is open to everyone.
- No backups. When a single file is lost, there is no route back.
If you feel brief pauses while the world saves, that is not a CPU problem: it is the world file being written to disk, and it depends on disk latency. The measurable side of it: what is an NVMe SSD?
On the DDoS side
Terraria servers usually serve small communities and have a narrow attack surface; on the other hand, because they run over a single TCP port, they are not immune to connection-flood style attacks. Filtering has to happen at the network layer: what is DDoS protection?
On Datafex servers, layered Fexwall DDoS protection is included free on every plan.
Next step
Buying a larger plan than needed is a common waste on Terraria; extra RAM does not show up in gameplay. We have put which step is enough for which world size and mod list on one page: Terraria server plans. If you plan to run several worlds on one machine, the vCPU steps on the virtual server plans become the deciding line, and you can pick resources yourself and see the monthly total in the server configurator.