01
Before you start
tModLoader is a separate program, distributed on Steam as free downloadable content for Terraria and endorsed by Re-Logic, the game's publisher. It has its own version numbers, its own worlds and its own characters, separate from those of the base game. Three rules apply throughout this guide:
- the same tModLoader version on the server and for every player: otherwise the game says you are not using the same version as the server;
- the same mods: most mods must be loaded on both sides;
- enough memory: tModLoader has been 64-bit since version 1.4, so it is no longer limited to about 4 GB like the old version. There is no official figure for the server: usage depends mostly on the mods, and large packs need much more than an unmodded world.
You need a 64-bit Linux VPS (Ubuntu or Debian) with a sudo user, secured as in securing a Linux VPS. The tModLoader documentation offers two methods: a Docker image, which it recommends, and the manage-tModLoaderServer.sh management script, which gives direct access to the files. This guide follows the script, with the terraria user from the guide creating a Terraria server; for the Docker method, see installing Docker on a VPS then the project's documentation.
02
Install the tModLoader server
Install the tools the script needs (curl to download, unzip to extract, tmux for the console) and SteamCMD, which will handle Workshop mods. On Ubuntu:
sudo apt update
sudo apt install -y software-properties-common curl unzip tmux
sudo add-apt-repository -y multiverse
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y steamcmd
On Debian, SteamCMD is in the non-free section: the steps are in the guide creating a Valheim server. Then create the server user if it does not exist, and download the official script into a folder of its own:
sudo useradd -m -s /bin/bash terraria
sudo -iu terraria
mkdir -p ~/tml && cd ~/tml
curl -LO https://raw.githubusercontent.com/tModLoader/tModLoader/1.4.5/patches/tModLoader/Terraria/release_extras/DedicatedServerUtils/manage-tModLoaderServer.sh
chmod +x manage-tModLoaderServer.sh
./manage-tModLoaderServer.sh install-tml --github
With --github, the script downloads the latest release published on GitHub, the same as on Steam, with no account. It installs it in ~/tml/server, creates the Mods and Worlds folders and installs the .NET version tModLoader needs. The documentation also describes an installation through SteamCMD (install-tml --username followed by your Steam username), which requires logging in with a Steam account. The ./manage-tModLoaderServer.sh -h command lists every option.
03
Add Workshop mods
The Workshop identifies mods by a number, not by their name: the server therefore needs a list prepared in tModLoader, on your computer.
- In tModLoader, enable the mods you want on the server.
- Go to Workshop, then Mod Packs, and click Save Enabled as New Mod Pack.
- Click Open Mod Pack Folder and open the folder named after the pack.
- Take
install.txt (the mods' Workshop numbers) and enabled.json (the mods to enable) from it.
Send these two files to the VPS, for example with scp to /tmp, then place them in the server's Mods folder and run the mod installation:
sudo install -o terraria -g terraria -m 644 /tmp/install.txt /tmp/enabled.json /home/terraria/tml/Mods/
sudo -iu terraria
cd ~/tml
STEAMCMDPATH=/usr/games/steamcmd ./manage-tModLoaderServer.sh install-mods
The script downloads each mod with SteamCMD, using an anonymous login, into ~/tml/steamapps. Things to know:
- without
install.txt, no mod is downloaded; without enabled.json, no mod is enabled;
enabled.json must list every mod to enable, including those placed by hand as .tmod files in Mods;
- if the pack also contains a
tmlversion.txt file, copy it into Mods: with --github, the script then installs the tModLoader version the pack was created with.
To change the list, make a new pack on your computer, replace the two files and run install-mods again, with the server stopped.
04
Configure, start and open port 7777
Without a configuration, the server asks questions on startup (Steam, world, player count…). For it to start on its own, create ~/tml/serverconfig.txt, which the script passes to it automatically:
world=/home/terraria/tml/Worlds/monde1.wld
autocreate=2
worldname=monde1
maxplayers=8
port=7777
password=un-mot-de-passe
motd=Bienvenue sur le serveur
The world path points to the .wld file, never the .twld that goes with it. autocreate creates the world if it does not exist (1 small, 2 medium, 3 large). To reuse an existing tModLoader world, copy its two files into ~/tml/Worlds.
Arguments placed after start are passed on to the server, for example -nosteam to connect by IP address, the option also offered by the start-tModLoaderServer.sh script shipped with tModLoader. For a service that starts with the VPS, leave the terraria user (exit) and create /etc/systemd/system/tmodloader.service:
[Unit]
Description=Serveur Terraria tModLoader
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=terraria
ExecStart=/usr/bin/tmux new-session -d -s tml -c /home/terraria/tml /home/terraria/tml/manage-tModLoaderServer.sh start -nosteam
ExecStop=/bin/sh -c '/usr/bin/tmux send-keys -t tml exit Enter; while /usr/bin/tmux has-session -t tml 2>/dev/null; do sleep 1; done'
TimeoutStopSec=120
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now tmodloader
sudo -u terraria tmux attach -t tml
sudo ufw allow 7777/tcp
If the official server from the Terraria guide is already running, stop it (sudo systemctl disable --now terraria): both use port 7777. The console accepts the Terraria server commands, without a slash: playing, save, say, kick, ban, exit (save and stop) and help. Leave it with Ctrl+B then D. The port is 7777 in TCP; the Terraria wiki advises also opening 7777 in UDP on a rented server if a player cannot connect (see game server ports).
05
Players, updates and backups
Players install tModLoader from Steam (they must own Terraria), then connect through the multiplayer menu with the VPS IP address and port 7777. Each mod declares which side it must run on: by default both, others only on the player's side or only on the server. The simplest way is to send players the mod pack folder, to put in their own packs folder (Open Mod Pack Folder button): in Mod Packs, View Mods in Mod Browser shows them the mods in the list and lets them download them.
Updates. When Steam updates tModLoader for players, the server must follow. Stop it, make a backup, then:
sudo systemctl stop tmodloader
sudo -iu terraria
cd ~/tml
STEAMCMDPATH=/usr/games/steamcmd ./manage-tModLoaderServer.sh install --github
exit
sudo systemctl start tmodloader
install updates tModLoader and the mods in one go; install-mods only updates the mods. The script keeps an archive of the previous version in ~/tml/server, useful to roll back. If you copied a tmlversion.txt, it pins the version: replace it with the one from a new pack, or remove it. The script also tells you when a new version of itself exists (update-script).
Backups. A tModLoader world takes two files: the .wld and the .twld holding mod data. Keep them together, with the mod list and the configuration:
sudo -u terraria tmux send-keys -t tml save Enter
sleep 10
sudo tar czf /root/tml-$(date +%F).tar.gz -C /home/terraria/tml Worlds Mods serverconfig.txt
Move the archive off the VPS, and schedule it every night (see scheduled tasks on a VPS). Before adding or removing a mod, always make a backup: a world can keep traces of a removed mod.
06
On CloudFive
CloudFive has no ready-made Terraria plan: the tModLoader server is installed on a VPS, as in this guide. The Ryzen VPS, from €5.99 per month, is well suited:
- an AMD Ryzen 9 9950X, with DDR5 memory and NVMe storage: a fast core and memory for large mod packs;
- root access and a dedicated IPv4 address;
- basic anti-DDoS protection included. The game-specific filter is part of Premium Protection, a paid option (see protecting a game server against DDoS).
The servers are in France, on our own network, monthly with no commitment, with support in French 7 days a week. To choose the VPS size, see which VPS for a game server and the gaming VPS page.
07
Frequently asked questions
How do I create a modded Terraria server with tModLoader?
On a Linux VPS, download the official manage-tModLoaderServer.sh script and install the server with install-tml --github. Copy install.txt and enabled.json from a mod pack into the Mods folder and run install-mods. Finally, write a serverconfig.txt, start with start -nosteam and open port 7777 in TCP.
How do I install Workshop mods on a tModLoader server?
In tModLoader on your computer, create a pack with Workshop, Mod Packs, Save Enabled as New Mod Pack. Copy its install.txt and enabled.json into the server's Mods folder, then run manage-tModLoaderServer.sh install-mods, which downloads the mods with SteamCMD.
Do players need the same mods as the tModLoader server?
Yes for most mods, which run on both sides, and always the same tModLoader version. Some mods only run on the player's side or only on the server; the mod's page says so.
Which port does a tModLoader server use?
The same as Terraria: 7777 in TCP by default, set with port= in serverconfig.txt. The Terraria wiki advises also opening 7777 in UDP on a rented server if a player cannot connect.
How much RAM for a Terraria server with tModLoader?
There is no official figure: memory depends mostly on the installed mods. tModLoader has been 64-bit since version 1.4 and can therefore go beyond 4 GB; keep some headroom for a large mod pack.