Workload · Hosting a Terraria world

A Terraria dedicated server that keeps your world open, even when your PC is off

To run a Terraria dedicated server, you download the free server package from terraria.org, start its Linux program with a small text file of settings, and let players connect to your server's address on port 7777. Done that way, your world no longer depends on the host's gaming PC being switched on. Below is the whole route, from an empty server to a backed-up world, plus TShock if you want proper admin tools.

The short version
  1. The world stays reachable while every player's PC is off
  2. Players connect on port 7777 unless you choose another
  3. A small world needs around half a gigabyte of free memory
  4. TShock adds accounts, admin groups and plugins

Why move your world off your own PC

Hosting from inside the game runs the world on one player's own copy of Terraria, so the world is only open while that copy is running. A dedicated server is the same game world run by a separate program, with no player attached, so friends in other time zones can build while you sleep.

There are two things to know before you start. When the server is empty it hibernates and in-game time stops until somebody connects, so leaving it running costs your world nothing. And it only saves properly on shutdown if you stop it with the exit command, which matters later.

How big a server do you need?

Less than you might think. The official Terraria wiki asks for roughly 500 MB of free memory while the world is small, and more as it grows and as more people join. It gives no processor requirement. If you add TShock, its own guide wants a minimum of 1 GB.

That makes a whole physical server a lot of machine for one small world, and it is fair to say so. If one modest world is all you plan to run, a Cloud VPS is the better-sized buy. A whole server starts to make sense when you want several worlds side by side, a vanilla world next to a TShock one, other games for the same group, or space that nobody else shares.

The server that fits

Our game server machines are whole bare metal servers on HPE enterprise hardware: the processors, the memory and the disks belong to you alone, with root access and no other customer on the box. Here is what that means for a Terraria group:

  • Nothing meters the port. Every server comes with an unmetered connection, so a busy weekend never turns into a traffic bill.
  • Your own switch port. It is not shared with any other customer at the access switch.
  • Close to your players. Pick a US city (San Francisco, Miami or New York) or a European one (Bucharest or Amsterdam); the data center page helps you pick.
  • Quick to start. A racked machine is ready about 30 minutes after your order is approved; payment checks can add time.
  • A way back in. Rack servers and blades include a remote console, handy if a firewall change locks you out.
  • No contract. You pay month to month, and someone answers live chat, email and phone around the clock.

Up and running in an evening

These commands are the wiki's Ubuntu instructions, with one change of ours: we create a separate terraria account so the game never runs as root. The file name includes the version number; 1458 means 1.4.5.8, the newest when we wrote this, so look on the wiki for a later file first.

  1. Order a server with Ubuntu, then sign in over SSH.
  2. Run the commands below. tmux keeps the game running after you disconnect.
  3. Create serverconfig.txt in the home folder (next section) before you start the program.
  4. Detach from tmux by pressing Ctrl+b and then d. To return later, sign in over SSH, run sudo -iu terraria, then tmux attach -t world.
  5. Have your friends open Multiplayer in the game, choose to join by IP and type your server's address and the port.
sudo apt update && sudo apt install -y wget tmux unzip
sudo useradd -m -s /bin/bash terraria
sudo -iu terraria
wget https://terraria.org/api/download/pc-dedicated-server/terraria-server-1458.zip
unzip terraria-server-1458.zip
cd 1458/Linux
chmod +x TerrariaServer.bin.x86*
tmux new -s world
./TerrariaServer.bin.x86_64 -config ~/serverconfig.txt

Already have a world from your PC? Upload the world's .wld to the ~/.local/share/Terraria/Worlds/ folder and set world to that file name in the settings.

Settings you will actually change

Settings go in a plain text file, one per line. The server only reads it when you start it with -config, as the commands above do. This example makes a medium world the first time it starts and reuses it every time after that:

world=/home/terraria/.local/share/Terraria/Worlds/ourworld.wld
autocreate=2
worldname=ourworld
difficulty=1
maxplayers=10
port=7777
password=choose-something-long
motd=Mind the Wall of Flesh
secure=1
upnp=0
  • autocreate: the size of a brand new world: 1 for small, 2 for medium, 3 for large.
  • difficulty: Normal is 0, Expert 1, Master 2 and Journey 3.
  • maxplayers: anywhere from 1 to 255. Leave it out and you get 16.
  • password: keeps strangers out. Because it is stored as plain text, run chmod 600 ~/serverconfig.txt.
  • secure=1: switches on extra protection against cheating.
  • upnp=0: a rented server already has a public address, so router port forwarding does not apply.

Letting your friends in

Players reach the game on port 7777. The wiki describes the server as listening on TCP, and for cloud servers it recommends opening the port for both TCP and UDP. With Ubuntu's firewall, allow SSH first so you keep your own way in, then the game:

  1. sudo ufw allow OpenSSH
  2. sudo ufw allow 7777/tcp and sudo ufw allow 7777/udp
  3. sudo ufw enable

Running a second world? Give it a different port in its own settings file and open that port too.

Keeping the world safe day to day

You manage a running server by typing into its console, without a slash in front. playing shows who is on, save writes the world to disk, say sends everyone a message, kick and ban remove a player, and exit saves and shuts down. To unban someone, take their name and IP out of banlist.txt.

Backups are your job, so make them a habit. Our routine: type save in the console, then open a second SSH window, switch to the game account with sudo -iu terraria, and archive the worlds folder with tar czf ~/world-backup.tar.gz -C ~/.local/share/Terraria Worlds. The archive is saved as /home/terraria/world-backup.tar.gz; download it to your own computer. Do it before every game update and after any big boss night. Never close the tmux window or kill the program to stop the server; use exit, or you lose everything since the last autosave.

Want admin tools? Add TShock

The plain server is fine for a group of friends behind a password. Once you open the world to people you do not know, TShock, a separate server package, gives you player accounts, admin groups, in-game moderation, automatic backups and plugins.

  1. Install the .NET runtime version that the TShock guide lists, then download and unzip the newest TShock release for Linux from its GitHub page.
  2. Start it with ./TShock.Server. It creates a tshock folder that holds its settings (config.json) and its database (tshock.sqlite).
  3. Join the game and look in the server console for a one-time setup code. Type /setup and that code in the game chat. (To keep strangers out until you finish, set ServerPassword in tshock/config.json first.)
  4. Make your own owner account with /user add, giving a name, a password and the group owner, and sign in with /login. A second /setup turns the setup code off.

By default TShock saves a backup into tshock/backups every 10 minutes and keeps each one for 240 minutes. Its web API (port 7878) starts switched off; keep it that way unless you need it. Copy tshock.sqlite somewhere safe as well, because without it you would have to set TShock up from scratch.

Questions people ask

Is a whole server overkill for Terraria?
For one small world, usually yes, and a Cloud VPS is the smaller fit. A whole server pays off when you run several worlds or games, use TShock with plugins, or want hardware no one else shares. Either way, the world stays up while your own PC is off.
What address do my friends type in?
Your server's public IP address, plus the port if you changed it from 7777. In the game they open Multiplayer and join by IP. If you set a password, they will be asked for it.
Will we lose progress if the server restarts?
Not if it is stopped with the exit command, which saves first. The server also saves now and then on its own, and since version 1.4.5.0 when the last player leaves. A crash or power cut can lose what happened after the last save, which is why regular backups matter.
Can I play on the same world I started at home?
Yes. Upload the world file into the server's Worlds folder, point the world setting at it and start the server. Keep a copy of the original file on your PC until you have seen it load.
Do I need TShock?
Not for a private group. It is worth adding when the server is public or the group is large, because it adds accounts, permissions, moderation and automatic backups. It also wants more memory, at least 1 GB by its own guide.

Give your world a home of its own

A whole server for your Terraria group, on an unmetered port, month to month, with people on hand around the clock.

Start your Terraria server

Read next