Terraria Dedicated Server
Ubuntu 24.04 LTS // Automated Install
| File | install-terraria.sh |
| Type | Bash installer script |
| Target OS | Ubuntu 24.04 LTS |
| Service | systemd |
A shell script that automates setup of a dedicated
Terraria
game server — installs dependencies, downloads the current server build,
writes serverconfig.txt, opens the firewall port, and
registers a systemd service so the server survives reboots.
Safe to re-run for updates: every rerun backs up the existing
serverconfig.txt and world file to a timestamped
backups/ folder before writing anything new. Every prompt
also has a matching flag, so the whole thing can be scripted with
--unattended.
// Install
1Install curl.
sudo apt update sudo apt install -y curl
2Download the script.
curl -O https://logiclinkrepair.com/sys.archive/games_servers/Terraria/install-terraria.sh
3Make it executable.
chmod +x install-terraria.sh
4Run it as root.
sudo ./install-terraria.sh
Installs remaining prerequisites (wget, unzip, jq), creates a dedicated terraria user, and pulls the current server build automatically.
5Configure on first run.
When prompted: server type (vanilla/modded), world name, port, max players, password, MOTD, difficulty, whether to open the firewall port, and whether to install the playit.gg tunnel agent. Each answer is validated (bad port/difficulty values are rejected) before it's written to
serverconfig.txt.6Or run it unattended.
sudo ./install-terraria.sh --unattended --port=7777 --difficulty=1
Skips every prompt using flags/env vars and defaults — useful for scripted deploys. Run with
--help for the full flag list. If no TTY is available and a value wasn't supplied, it falls back to defaults automatically instead of hanging.7Manage the service.
sudo systemctl status terraria sudo systemctl restart terraria sudo journalctl -u terraria -f
If startup isn't confirmed within 60s, the script prints these same commands so you can check what's going on.
// Workshop Mod Install (tModLoader)
Adds a mod straight from the Steam Workshop onto the server via
steamcmd —
no client-side subscription needed. Requires the tModLoader variant of the
server (see step 1 of the main install above).
| File | install-mod.sh |
| Type | Bash installer script |
| Input | Workshop item ID |
Give it one argument — the numeric Workshop item ID — and it handles
everything: installs
steamcmd if missing, downloads the mod,
finds the correct .tmod build even if nested under a
version subfolder, copies it into the Mods folder, fixes
ownership, merges the mod into enabled.json without disabling
anything already active, restarts the service, and tails the log so you
can confirm it loaded.
1Download the script.
curl -O https://logiclinkrepair.com/sys.archive/games_servers/Terraria/install-mod.sh
2Make it executable.
chmod +x install-mod.sh
3Run it with the mod's Workshop ID.
sudo ./install-mod.sh 2824688072
Find the ID in the mod's Steam Workshop URL — the number after
?id=. Run again with a different ID to add another mod; existing enabled mods aren't affected.// Manual Install (Command Line)
Same result as the script above, broken out step by step — useful if
you want to see exactly what's happening, or need to troubleshoot a
specific stage.
1Enable 32-bit support and install SteamCMD.
sudo add-apt-repository multiverse -y sudo dpkg --add-architecture i386 sudo apt update sudo apt install -y steamcmd
2Download the mod from the Workshop.
steamcmd +login anonymous +workshop_download_item 1281930 2824688072 +quit
1281930 is the tModLoader app ID; 2824688072 is the Workshop item ID — swap the second number to grab a different mod.
3Copy the mod into the Mods folder.
cp /root/.steam/steam/steamapps/workshop/content/1281930/2824688072/*.tmod /home/terraria/.local/share/Terraria/tModLoader/Mods/
4Enable the mod in
enabled.json.cat /home/terraria/.local/share/Terraria/tModLoader/Mods/enabled.json
Copying the
.tmod file isn't enough — tModLoader only loads mods listed here. If it just shows [], add the mod's internal name (matches the filename minus .tmod):cat <<'EOF' > /home/terraria/.local/share/Terraria/tModLoader/Mods/enabled.json ["ModNameHere"] EOF
Adding more than one mod? Comma-separate them:
["ModOne", "ModTwo"]. This is the step that gets missed — a mod present but not enabled loads silently and just never shows up in-game, with no error in the log.5Fix ownership and restart the service.
sudo chown -R terraria:terraria /home/terraria/.local/share/Terraria/tModLoader/Mods/ sudo systemctl restart terraria sudo journalctl -u terraria -f
Check the log for a load line naming your mod right before "Server started" — that confirms it's active, not just installed.