Terraria multiplayer works best on a dedicated server: the world stays online, everyone connects to the same place, and there’s no “host left, everyone disconnected”. The server is lightweight, so even a small VPS runs it well. You can use the vanilla server from the official site, or TShock, which adds admin tools, permissions, anti-cheat and plugins.

Requirements

  • 1–2 vCPU and 1–2 GB RAM for small groups. Large worlds and many players (or tModLoader mods) need more.
  • TCP port 7777.
  • A server location near your players. See game server VPS.

Option 1: vanilla server

Download the dedicated server zip from the official Terraria website (the “PC Dedicated Server” link at the bottom of terraria.org). Replace the version number in the commands below:

sudo apt install -y unzip tmux
sudo adduser --disabled-password --gecos "" terraria
sudo -iu terraria
wget https://terraria.org/api/download/pc-dedicated-server/terraria-server-1449.zip
unzip terraria-server-*.zip
cd 1449/Linux
chmod +x TerrariaServer.bin.x86_64

serverconfig.txt

world=/home/terraria/worlds/MyWorld.wld
autocreate=2             # 1 small, 2 medium, 3 large
worldname=MyWorld
difficulty=0             # 0 classic, 1 expert, 2 master, 3 journey
maxplayers=8
port=7777
password=secret-pass
motd=Welcome!
worldpath=/home/terraria/worlds
secure=1
mkdir -p ~/worlds
./TerrariaServer.bin.x86_64 -config serverconfig.txt

With autocreate, the world is generated on the first start, which takes a minute or two.

TShock is a server mod with user accounts, groups and permissions, region protection, bans, a REST API and plugins. Download the latest Linux release from its GitHub page (it bundles the .NET runtime in recent versions), unpack it, and run:

./TShock.Server -world /home/terraria/worlds/MyWorld.wld -port 7777 -maxplayers 16

On first start, TShock prints a setup code. Join the game and type /setup <code>, then /user add <name> <password> owner, and log in with /login. After that, setup mode is disabled. Configure TShock in tshock/config.json (server password, spawn protection, anti-cheat options).

For tModLoader (modded Terraria), use its own dedicated server from the tModLoader release (Steam app 1281930), and give it more RAM.

Keep it running: tmux or systemd

The vanilla server reads commands from the console (save, exit, kick), so tmux is handy:

tmux new -s terraria
./TerrariaServer.bin.x86_64 -config serverconfig.txt
# detach: Ctrl+B then D; reattach: tmux attach -t terraria

See tmux. For automatic start on boot, use a systemd unit that runs the server inside tmux or screen, so you keep console access. Or use TShock, whose admin commands also work in game and through its REST API. See systemd unit files.

Always stop with exit (or /off in TShock), so the world is saved. Killing the process loses progress since the last autosave.

Firewall

sudo ufw allow 7777/tcp

See UFW.

Joining

In Terraria: Multiplayer → Join via IP, enter the server IP, port 7777, and the password.

Backups

Worlds are single .wld files (plus .wld.bak):

tar czf /backups/terraria-$(date +%F-%H%M).tgz -C /home/terraria worlds

Back up every few hours with cron, and before updates, and copy backups off-site. See crontab and backup strategy.

Performance tips

  • Expert and Master mode worlds with many players spawn more enemies, which adds CPU load.
  • Large worlds use more RAM. Medium is a good balance for groups of up to about 8 players.
  • If players rubber-band, check the server’s CPU and the network path with mtr.

Updating

Download the new server zip (vanilla) or TShock release, and keep your worlds folder and config. TShock usually needs a matching release for each new game version, so check before updating clients.

Quick reference

Item Value
Port 7777/tcp
Vanilla binary TerrariaServer.bin.x86_64 -config serverconfig.txt
TShock first admin /setup <code> → /user add … owner
Save and stop exit (vanilla), /off (TShock)
Worlds .wld files in worldpath

Related: Valheim dedicated server and Minecraft server.

  • Game Server
  • Linux
  • Self-Hosting