Self-hosting a Terraria server with TShock (and when renting one is worth it)
Updated: 02 October 2026 · Guide · VPS · Game server
Terraria comes with its own server, but it only lets players connect: no permissions, no protection against griefing. Almost every long-running server therefore uses TShock, an open-source server extension. Ours do too.
Get TShock
TShock is available as a ready-made archive in the project's releases on GitHub (Pryaxis/TShock). It needs the .NET runtime in the version the respective release names. Extract, then start. With -autocreate the server creates a world if none exists yet (1 = small, 2 = medium, 3 = large):
./TShock.Server -port 7777 -maxplayers 8 -world worlds/world.wld -autocreate 2
Open the port
sudo ufw allow 7777/tcp
Terraria connects over TCP, not UDP. Fellow players choose “Join via IP” and enter first the address, then the port.
The first start: setup code
On first start TShock writes a one-time setup code to the console. In game you enter /setup with this code and create the first admin with it; after that the code is used up. If you miss the code, you have a server without an admin. Settings are then in tshock/config.json, permission groups in the database next to it.
Updates
After a Terraria update you need a new TShock version. It usually appears only a few days after the game update; until then, clients with the new version can't join the server. Copy the world (.wld) before every switch.
When it doesn't run
“You must install or update .NET to run this application” or “framework not found” at start: TShock can't find the .NET version it was built for. For us TShock required .NET 9; a server with .NET 6 aborted with exactly this message. Which version is needed is stated in TShock's release notes.
The connection fails immediately: the port was opened as UDP instead of TCP. Terraria only speaks TCP.
The server no longer starts after a change to tshock/config.json: the file is no longer valid JSON, or an empty object ({}) has turned into an empty list ([]). That's exactly what happens when the file is read and written back with some scripting languages; TShock then aborts while reading it. Make a copy before every change and look at the log after starting.
Running, but nobody can join? First check whether the process is really listening on the port you opened. “The process is running” doesn't prove that: we had a server exposed on a port where nothing was listening, and that only showed up in a targeted check.
sudo ss -tlpn | grep 7777
Keep it running permanently
Instead of tmux or screen: as a systemd service the server starts by itself after a machine reboot, and a crash leads to a new start instead of an empty server. Create the file /etc/systemd/system/terraria.service:
[Unit] Description=Terraria Server After=network-online.target Wants=network-online.target [Service] User=<username> WorkingDirectory=/home/<username>/tshock ExecStart=/home/<username>/tshock/TShock.Server -port 7777 -world worlds/world.wld Restart=on-failure [Install] WantedBy=multi-user.target
sudo systemctl daemon-reload sudo systemctl enable --now terraria journalctl -u terraria -f
Use -world instead of -autocreate once the world exists: otherwise a wrong path silently creates a new, empty world on the next start. A restart via systemctl stops the server without saving in game first; enter save in the console beforehand.
Measured: a fresh server without players
Freshly ordered and without players, measured on 28 September 2026 on our game server node (Xeon Gold 6138): installation took 34 seconds, the first start until ready 95 seconds. After that TShock used 271 MB of RAM and 16 % of one core, 102 MB on disk. A full backup was 39 MB compressed and done in one second. The server only listened on TCP. RAM excluding file cache, CPU as a share of one core at idle.
Self-host or rent: the honest trade-off
Terraria is undemanding, and self-hosting is very doable.
With a server rented from us, TShock is preinstalled, the config.json fields are in the control panel, and a world reset is one click there. We install TShock updates on request via ticket; every night the server creates a backup, keeping the last seven.
- Rent a Terraria serverTShock preinstalled, settings in the control panel
- All Terraria settings in the panelGenerated from the control panel's source code
- Before this: secure the VPSSet up SSH key and firewall
- Server running, but nobody can join?Five checks and all default ports