To host a Terraria server on Linux, download the dedicated server zip from terraria.org, unpack its Linux folder, write a serverconfig.txt, open TCP port 7777 and run TerrariaServer.bin.x86_64 inside tmux. As of October 2026 the official Terraria wiki lists 1.4.5.8 as the current server. Vanilla needs little: 1 to 2 GB of RAM covers a small group.
This guide does the setup on Debian 12 or 13 or Ubuntu 24.04: the vanilla server, a systemd service that saves the world on stop, TShock for admin tools, the tModLoader server for mods, backups, and which plan size you actually need.
| Item | Value |
|---|---|
| Download | terraria.org, “PC Dedicated Server” link at the bottom of the page |
| Current version | 1.4.5.8 (official Terraria wiki, October 2026) |
| Port | TCP 7777, changed with port= or -port |
| Config file | serverconfig.txt, passed with -config |
| Default world folder | ~/.local/share/Terraria/Worlds |
| Console commands | save, exit, kick, ban, playing |
| TShock | 6.2.1 for Terraria 1.4.5.8, needs the .NET 9 runtime |
| tModLoader server | Separate download, its own management script |
How much RAM does a Terraria server need?
Not much, as game servers go. We found no memory figure for the dedicated server from Re-Logic, so the numbers below are our starting points, not official requirements. What drives them is world size and what the world holds (NPCs, projectiles, big farms), far more than player count:
| Server | RAM | vCores |
|---|---|---|
| Vanilla, small or medium world, a few friends | 1 GB free | 1 |
| Vanilla or TShock, large world, up to about 16 players | 2 GB free | 1 to 2 |
| tModLoader with a large content mod pack | 4 to 8 GB free | 2 |
The server does most of its world update on one main thread, so a fast core helps more than many cores. Mods change everything: big tModLoader packs load their own content into memory, and some add enough per-tick work to need the faster core as well. Check real usage with free -h and htop after a busy evening, not right after the first start.
How do I install the vanilla Terraria server on Linux?
You need neither Steam nor SteamCMD: the server is a free zip from terraria.org. It runs as its own unprivileged account with /opt/terraria as its home.
- 1Install the tools and create the user
Debian · Ubuntu sudo apt update sudo apt install -y curl unzip tmux sudo useradd --system --create-home --home-dir /opt/terraria --shell /usr/sbin/nologin terraria - 2Download and unpack the server
Copy the current “PC Dedicated Server” link from the bottom of terraria.org. The file name carries the version without dots, so 1.4.5.8 is
terraria-server-1458.zip:Debian · Ubuntu sudo -u terraria -H sh -c 'cd /opt/terraria && curl -fL -o terraria-server.zip \ https://terraria.org/api/download/pc-dedicated-server/terraria-server-1458.zip && unzip -q terraria-server.zip' sudo ls /opt/terraria/1458 # Linux, Mac, WindowsThe archive unpacks into a folder named after the version, with one subfolder per platform. If a later archive differs,
lsshows the new name. - 3Put the Linux build in place
Debian · Ubuntu sudo -u terraria cp -r /opt/terraria/1458/Linux /opt/terraria/server sudo -u terraria chmod +x /opt/terraria/server/TerrariaServer.bin.x86_64 sudo -u terraria mkdir -p /opt/terraria/worlds /opt/terraria/backups
serverconfig.txt: the settings that matter
Without a config file, the server asks for the world, slots, port and password in an interactive menu at every start. A serverconfig.txt answers those questions, and with autocreate set it creates the world on the first start:
world=/opt/terraria/worlds/myworld.wld
autocreate=2
worldname=myworld
difficulty=1
maxplayers=8
port=7777
password=choose-a-password
motd=Welcome to the server
worldpath=/opt/terraria/worlds
banlist=/opt/terraria/banlist.txt
secure=1
upnp=0| Key | Values | Notes |
|---|---|---|
world | Path to a .wld file | Loaded at start; created if missing and autocreate is set |
autocreate | 1 small, 2 medium, 3 large | Only used when the world file does not exist |
difficulty | 0 normal, 1 expert, 2 master, 3 journey | Applies to newly created worlds |
maxplayers | Slot count | Set your real group size |
password | Any string, or leave out | Without it anyone with the IP can join |
secure | 1 to enable | Turns on the server's built-in cheat protection |
upnp | 0 on a VPS | Port forwarding on home routers; a VPS has no router to talk to |
seed | Any seed string | Optional, for autocreate |
Run it once in the foreground to watch the world being generated, then type exit at the server prompt, which saves and quits:
sudo -u terraria -H sh -c 'cd /opt/terraria/server && ./TerrariaServer.bin.x86_64 -config /opt/terraria/serverconfig.txt'Which port does a Terraria server use?
TCP 7777, and nothing else for players. Terraria does not use UDP. Allow SSH first, then the game port:
sudo apt install -y ufw # preinstalled on Ubuntu
sudo ufw allow 22/tcp # your SSH port, first
sudo ufw allow 7777/tcp comment 'Terraria'
sudo ufw enable
sudo ss -tlnp | grep 7777 # is the server listening?With the server running, test from outside with our port checker: an open result on 7777 means players can reach it. A second server on the same machine simply takes 7778.
How do I keep the server running: tmux and systemd
The Terraria server is built to read commands from a console, and you will want that console for save, kick and exit. tmux gives it one that keeps running after you log out. The quick way, by hand:
sudo -u terraria tmux -L terraria new-session -d -s terraria -c /opt/terraria/server \
/opt/terraria/server/TerrariaServer.bin.x86_64 -config /opt/terraria/serverconfig.txt
sudo -u terraria tmux -L terraria attach -t terraria # the console; Ctrl+b then d detachesThe tmux cheat sheet has the rest of the keys. To start it at boot and save cleanly on shutdown, let systemd start that same tmux session and type exit into it on stop:
[Unit]
Description=Terraria dedicated server
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=terraria
Group=terraria
WorkingDirectory=/opt/terraria/server
ExecStart=/usr/bin/tmux -L terraria new-session -d -s terraria -c /opt/terraria/server /opt/terraria/server/TerrariaServer.bin.x86_64 -config /opt/terraria/serverconfig.txt
# type "exit" into the console (save and quit), then wait for the session to end
ExecStop=/usr/bin/tmux -L terraria send-keys -t terraria exit Enter
ExecStop=/bin/sh -c 'while /usr/bin/tmux -L terraria has-session -t terraria 2>/dev/null; do sleep 1; done'
TimeoutStopSec=60
Restart=always
RestartSec=15
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now terraria
sudo -u terraria tmux -L terraria attach -t terraria # console, as beforeRestart=always is deliberate: when the server process ends, the tmux session ends with it and exits cleanly, which on-failure would not count as a crash. The side effect is that typing exit in the console restarts the server; stop it with sudo systemctl stop terraria instead. The systemd service guide explains each line of a unit like this one.
How do I run a TShock server?
TShock is the community server mod most public Terraria servers run: accounts and groups, permissions, region protection, server-side characters and anti-cheat on top of the vanilla server. Its releases come from the Pryaxis/TShock repository on GitHub, and each release names the Terraria version it is built for: as of October 2026 the newest is TShock 6.2.1 for Terraria 1.4.5.8. TShock 6 moved to .NET 9, so install that runtime first. On Debian 12 that comes from Microsoft’s package repository; for Ubuntu and Debian 13 follow Microsoft’s Linux install page for your release:
curl -fsSLo /tmp/packages-microsoft-prod.deb https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb
sudo dpkg -i /tmp/packages-microsoft-prod.deb
sudo apt update && sudo apt install -y dotnet-runtime-9.0
dotnet --list-runtimes # should list Microsoft.NETCore.App 9.0.xThen download the linux-x64 zip of the release that matches your server version into /opt/terraria/tshock, unzip it (if it contains a .tar, unpack that too), and start it against the world the vanilla server created:
sudo -u terraria chmod +x /opt/terraria/tshock/TShock.Server
sudo -u terraria -H sh -c 'cd /opt/terraria/tshock && ./TShock.Server -world /opt/terraria/worlds/myworld.wld -port 7777'- On first start TShock creates a
tshockfolder withconfig.jsonand its SQLite database, and prints a one-time setup code in the console. - Join the server, type
/setup CODE, create your account with/user add NAME PASSWORD owner, log in with/login, then type/setuponce more to switch the setup system off. - For the service, point
ExecStartin the unit above at/opt/terraria/tshock/TShock.Serverwith the same arguments, and change the-cfolder andWorkingDirectoryto/opt/terraria/tshock.
What about a tModLoader server?
tModLoader is a separate build of the game for mods, and its server is separate too: a vanilla or TShock server cannot load .tmod files. The tModLoader repository on GitHub ships a script for this in its DedicatedServerUtils folder, manage-tModLoaderServer.sh, that installs the server from GitHub (or from SteamCMD with your Steam account), installs the mods and starts it. Workshop mods travel as two files, install.txt and enabled.json: export them from the game under Workshop, Mod Packs, “Save Enabled as New Mod Pack”, and place them in the Mods folder the script manages (its README shows the layout). Then:
./manage-tModLoaderServer.sh install-tml --github
./manage-tModLoaderServer.sh install-mods
./manage-tModLoaderServer.sh startIts launch scripts set up the .NET runtime tModLoader needs in a dotnet folder beside the server files, so you install nothing system-wide. The port is the same TCP 7777, and the tmux-under-systemd pattern above works unchanged with the start command swapped in. Size for the mod pack, not the player count: this is where the 4 to 8 GB row of the sizing table comes from.
How do I back up Terraria worlds?
A world is one .wld file in the world folder; the server keeps the previous save as .wld.bak beside it. Copy both off the machine regularly. This script asks the running server to save, waits, archives the folder and keeps the newest 28 archives:
sudo tee /opt/terraria/backup.sh >/dev/null <<'EOF'
#!/bin/sh
SRC=/opt/terraria/worlds
DEST=/opt/terraria/backups
mkdir -p "$DEST"
# ask the running server to save; if it is down, the files are already consistent
/usr/bin/tmux -L terraria send-keys -t terraria save Enter 2>/dev/null && sleep 10
tar -czf "$DEST/worlds-$(date +%F-%H%M).tar.gz" -C "$SRC" .
ls -1t "$DEST"/worlds-*.tar.gz | tail -n +29 | xargs -r rm --
EOF
sudo chown terraria:terraria /opt/terraria/backup.sh
sudo chmod 750 /opt/terraria/backup.sh
(sudo crontab -u terraria -l 2>/dev/null; echo "30 */6 * * * /opt/terraria/backup.sh") | sudo crontab -u terraria -We ran the archive and rotation part in a scratch directory on Debian 12 (GNU tar 1.34): with 31 archives present, it left the newest 28. To restore, stop the service, move the current world aside, unpack an archive into /opt/terraria/worlds and start again. A world also moves between servers this way: copy a local world’s .wld file from Documents/My Games/Terraria/Worlds on a Windows PC into the world folder and point world= at it.
How do players join?
- In Terraria, choose Multiplayer, then Join via IP, pick a character, and enter the server’s IP address and port
7777, then the password. - The client and server versions must match. After a game update, download the new server zip, copy its
Linuxfolder over/opt/terraria/serverand restart; worlds stay where they are. playingin the console lists who is online;kick NAMEandban NAMEdo what they say.
Why can’t players connect?
| Symptom | Confirm with | Fix |
|---|---|---|
| Connection times out | sudo ss -tlnp | grep 7777 | No output: the server is not running or waits in the start menu. Output: open TCP 7777 in ufw |
| Server asks for a world on every start | Start it with -config | Point -config at serverconfig.txt and set world= to a full path |
| Players see a version mismatch | Compare the zip number with the game's title screen | Install the matching server or TShock build |
| TShock exits at start | dotnet --list-runtimes | No 9.0 runtime listed: install dotnet-runtime-9.0 |
| Service restarts in a loop | journalctl -u terraria -n 50 | Usually a wrong path in ExecStart or the config; run the same line by hand to see the error |
Which VPS plan fits a Terraria server?
Terraria is one of the cheapest games to host. Our Hi-CPU KVM line runs on AMD EPYC and suits the single main thread; Standard KVM (Intel, DDR4 ECC) gives more memory per price step, which matters only for big mod packs:
| Server | Hi-CPU KVM | Standard KVM |
|---|---|---|
| Vanilla, a few friends | HI-CPU 1: 1 vCore, 2 GB | STANDARD KVM 1: 2 vCores, 4 GB |
| TShock community or several worlds | HI-CPU 2: 2 vCores, 4 GB | STANDARD KVM 1: 2 vCores, 4 GB |
| tModLoader with a large mod pack | HI-CPU 4: 4 vCores, 8 GB | STANDARD KVM 2: 4 vCores, 8 GB |
vCores are shared virtual cores, not reserved physical ones. Every plan sits behind always-on DDoS filtering, and you can pay by card, PayPal or crypto. Stock differs between Amsterdam and Frankfurt, so check the product page for your location. The same plan can run Terraria next to another small server; our gaming VPS page sizes other popular games on both lines.
Frequently asked
Which port does a Terraria server use?
TCP 7777 by default, set with port= in serverconfig.txt or -port on the command line. Terraria does not use UDP. Open 7777/tcp in the firewall; a second server on the same machine can take 7778.
How much RAM does a Terraria server need?
Little. A vanilla server for a few friends runs comfortably in 1 GB, and 2 GB covers a large world with more players. These are our starting points, as we found no official server figure from Re-Logic. tModLoader with a large content mod pack is different and can need 4 to 8 GB.
Can I run TShock on the latest Terraria version?
Only with a TShock build made for that version. As of October 2026, TShock 6.2.1 targets Terraria 1.4.5.8 and needs the .NET 9 runtime, whose support Microsoft ends on 10 November 2026. Each TShock release names the Terraria version it supports, so check it before updating the server.
How do I keep a Terraria server running after I log out?
Run it inside tmux, which keeps the server console alive after you disconnect. For a server that starts at boot, let systemd start a detached tmux session and type exit into the console on stop, so the world is saved before the process ends.