Terraria is a 2D action-adventure sandbox game developed by Re-Logic. With over 5000 items, bosses, NPCs, and extensive building mechanics, Terraria offers rich multiplayer experiences. This comprehensive guide covers hosting a Terraria dedicated server on a VPS or dedicated server.
7777 (TCP)1. Locate Terraria installation directory:
C:\Program Files (x86)\Steam\steamapps\common\Terraria\
2. Find TerrariaServer.exe in the main folder
3. Run TerrariaServer.exe
- Follow the setup wizard
- Choose existing world or create new
- Set max players
- Set port (default 7777)
- Set password (optional)
4. Server will start and display connection information
# Download Terraria server files
wget https://terraria.org/api/download/pc-dedicated-server/terraria-server-1449.zip
# Extract files
unzip terraria-server-1449.zip
cd 1449/Linux/
# Make executable
chmod +x TerrariaServer*
# Run server
./TerrariaServer.bin.x86_64
# Or for headless/background:
screen -S terraria ./TerrariaServer.bin.x86_64
# Detach with Ctrl+A, D
# Reattach with: screen -r terraria
# Download server files from terraria.org
# Extract and navigate to Mac folder
cd ~/terraria-server/Mac/
# Make executable
chmod +x TerrariaServer*
# Run server
./TerrariaServer.bin.osx
Create serverconfig.txt in the server directory:
# World Configuration
world=/path/to/Worlds/MyWorld.wld
autocreate=3
worldname=MyWorld
# Server Settings
maxplayers=16
port=7777
password=YourPassword
motd=Welcome to my Terraria server!
# Security
banlist=banlist.txt
secure=1
# Network
priority=1
npcstream=60
| Parameter | Description | Values |
|---|---|---|
world |
Path to world file | /path/to/world.wld |
autocreate |
Auto-create world size | 1=Small, 2=Medium, 3=Large |
maxplayers |
Maximum player slots | 1-255 (8-16 typical) |
port |
Server port | Default: 7777 |
password |
Server password | Any string (optional) |
motd |
Message of the day | Text message |
difficulty |
World difficulty | 0=Normal, 1=Expert, 2=Master |
secure |
Prevent cheating | 0=Off, 1=On |
npcstream |
NPC update frequency | Default: 60 |
# Forward TCP port 7777 (or your configured port)
# Linux firewall (UFW):
sudo ufw allow 7777/tcp
sudo ufw reload
# Windows Firewall:
New-NetFirewallRule -DisplayName "Terraria Server" -Direction Inbound -Protocol TCP -LocalPort 7777 -Action Allow
TShock is a server modification that adds extensive administrative features, permissions, anti-grief protection, and plugin support to Terraria servers.
# Download TShock from https://github.com/Pryaxis/TShock/releases
# Extract TShock files
unzip TShock.zip
# Run TShock server
./TShock.Server
# First run creates configuration files
# Configure in tshock/config.json
/user add USERNAME PASSWORD GROUP
/group add GROUPNAME "permissions"
/region define REGIONNAME
/whitelist add USERNAME
/ban add USERNAME reason
/give PLAYER ITEMID AMOUNT
/time set 12:00
/butcher - Kill all hostile NPCs
Problem: Server fails to launch or crashes immediately.
Solutions:
netstat -an | grep 7777)chmod +x TerrariaServer*)Problem: Players can't join the server.
Solutions:
telnet SERVERIP 7777Problem: Server experiences lag or stuttering.
Solutions:
Problem: World file corrupted or won't load.
Solutions:
Problem: Mods not loading or causing crashes.
Solutions:
# Linux backup script
#!/bin/bash
WORLD_DIR="/path/to/Terraria/Worlds"
BACKUP_DIR="/path/to/backups"
DATE=$(date +%Y%m%d_%H%M%S)
# Create backup
tar -czf $BACKUP_DIR/terraria_backup_$DATE.tar.gz $WORLD_DIR
# Keep only last 14 days
find $BACKUP_DIR -name "terraria_backup_*.tar.gz" -mtime +14 -delete
Set up daily restarts for optimal performance:
# Linux crontab for 4 AM restart
0 4 * * * /path/to/restart_terraria.sh
# restart_terraria.sh:
#!/bin/bash
pkill -9 TerrariaServer
sleep 5
cd /path/to/terraria
screen -dmS terraria ./TerrariaServer.bin.x86_64 -config serverconfig.txt
TModLoader is a mod loader for Terraria that allows players to create and play mods.