Terraria

PlatformSupportNotes
Linux✅ NativeVia TShock
Windows✅ Native

Terraria is a 2D sandbox game that supports dedicated servers for up to 255 players. The server is very lightweight: 1 GB of RAM and 1 CPU core are more than sufficient.

02

Requirements

ComponentMinimum
RAM1 GB
CPU1 core
Disk1 GB
OSUbuntu 22.04 / Debian 12
Port7777 TCP
03

Installation with TShock (recommended)

TShock is the Terraria server with plugins, permissions and admin commands. It's used by almost all public servers.

bash
# Install .NET Runtime
apt install -y dotnet-runtime-8.0
# If not available:
curl -sSL https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 8.0
export PATH=$PATH:~/.dotnet

# Create user and directory
useradd -m -s /bin/bash terraria
su - terraria
mkdir ~/tshock && cd ~/tshock

# Download TShock (latest version from GitHub Releases)
TSHOCK_VERSION="5.2.0"
wget https://github.com/Pryaxis/TShock/releases/download/v${TSHOCK_VERSION}/TShock-${TSHOCK_VERSION}-for-Terraria-1.4.4.9-linux-x64-Release.zip
unzip TShock-*.zip
chmod +x TShock.Server
04

First Run and Configuration

bash
# First execution: creates configuration files
./TShock.Server -world ~/tshock/worlds/MyWorld.wld -worldname "MyWorld" -port 7777 -maxplayers 20 -autocreate 2

On first run TShock generates /serverconfig.json and asks to set admin password via in-game command /setup CODE.

05

Startup Script

bash
cat > ~/start_terraria.sh << 'EOF'
#!/bin/bash
cd ~/tshock
./TShock.Server \
  -world ~/tshock/worlds/MyWorld.wld \
  -port 7777 \
  -maxplayers 20 \
  -noupnp \
  -autocreate 2 \
  2>&1 | tee ~/tshock/logs/server.log
EOF
chmod +x ~/start_terraria.sh
mkdir -p ~/tshock/worlds ~/tshock/logs
06

systemd Service

bash
exit  # return to root
cat > /etc/systemd/system/terraria.service << 'EOF'
[Unit]
Description=Terraria TShock Server
After=network.target

[Service]
User=terraria
WorkingDirectory=/home/terraria/tshock
ExecStart=/home/terraria/start_terraria.sh
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable --now terraria
07

Firewall

bash
ufw allow 7777/tcp
08

TShock Admin Commands

Connect to the server in-game, then use chat:

/login TSHOCK_ADMIN_PASSWORD # Player management /kick PlayerName reason /ban PlayerName reason /mute PlayerName /tp PlayerName # teleport from you # Permissions /group addperm admin tshock.world.time.set /user group PlayerName VIP # World commands /time noon /time midnight /bloodmoon # start blood moon /save # save world # Info /who # online players /players
09

Configuration serverconfig.json

json
{
  "ServerPassword": "server_password",
  "ServerPort": 7777,
  "MaxSlots": 20,
  "ServerName": "My Terraria Server",
  "WorldPath": "/home/terraria/tshock/worlds/",
  "AutoSave": true,
  "AnnounceSave": true,
  "BackupInterval": 60,
  "BackupKeepCount": 10,
  "InvasionMultiplier": 1,
  "DefaultMaximumSpawns": 5,
  "LogPath": "/home/terraria/tshock/logs/",
  "EnableWhitelist": false
}
10

TShock Plugins

Plugin .dll files go in the ServerPlugins/ folder:

bash
# Download plugins from https://github.com/Pryaxis/TShock/wiki/Plugins
# Example: EssentialsPlus
wget https://github.com/..../EssentialsPlus.dll -P ~/tshock/ServerPlugins/

# Restart to load
systemctl restart terraria

Popular plugins:

  • EssentialsPlus: warps, homes, custom spawns
  • WorldEdit: bulk world modification
  • AutoTeam: automatic teams for PvP
  • ItemBan: ban specific items
11

Automatic Backup

bash
echo "0 */4 * * * terraria tar -czf ~/tshock/backups/world-\$(date +\%Y\%m\%d_\%H\%M).tar.gz ~/tshock/worlds/ 2>/dev/null" > /etc/cron.d/terraria-backup
12

Tips & Tweaks

TShock Permissions System

Organize players into permission groups:

Default groups:

Create custom group:

Via in-game (admin only):

/group addgroup MyGroup "Custom Group" /group addperm MyGroup tshock.world.time.set /group addperm MyGroup tshock.player.usewarp

Assign player to group:

/user group PlayerName MyGroup

Common permissions:

PermissionEffect
tshock.adminAll permissions
tshock.world.time.setChange time
tshock.world.time.getSee time
tshock.player.usewarpUse warps
tshock.player.sethomeSet home point
tshock.npc.hurttownHarm town NPCs
tshock.godGod mode access
tshock.kill.cyclopseKill specific NPC

REST API and ServerQuery

Access server programmatically:

bash
# Enable REST API in serverconfig.json
"RestApiEnabled": true,
"RestApiPort": 7878,

# Example API call
curl -X GET "http://localhost:7878/v3/players/info"

# With API token
curl -H "Authorization: Bearer YOUR_TOKEN" \
  "http://localhost:7878/v3/players/info"

Common REST endpoints:

World Size and RAM Requirements

Relationship between world size and server RAM:

World SizeRecommended RAMNotes
Small512 MB10-15 players
Medium1 GB20-30 players
Large2 GB50+ players
Journey's End (large)3+ GB100+ players
bash
# Set in start script
-maxplayers 20
-autocreate 2  # World size: 1=small, 2=medium, 3=large

TShock Admin Commands

Connect to server and type in chat (prefix with /):

bash
# Player management
/kick PlayerName           # Remove from server
/ban PlayerName reason     # Permanent ban
/banip 192.168.1.1        # IP ban
/unban PlayerName         # Remove ban
/mute PlayerName          # Prevent chat
/unmute PlayerName

# Admin/Group
/user add NewPlayer       # Add user
/group addgroup MyGroup   # Create group
/group addperm admin perm.name

# World & Environment
/time noon                # Set to noon
/time midnight            # Set to midnight
/bloodmoon               # Start blood moon
/fullmoon                # Start full moon
/eclipse                 # Solar eclipse
/grow                    # Grow trees
/cleannpc                # Remove loose items
/save                    # Save world manually

# Teleport & Movement
/tp PlayerName           # Teleport to player
/warp create name        # Create warp at location
/warp name               # Go to warp
/home                    # Go to home point
/sethome                 # Save current location

# Info & Debugging
/who                     # Online players
/players                 # Player details
/playing                 # Active players
/whisper player message  # Private message
/slap PlayerName         # Hit player (non-damage)

World Backup Procedures

Manual backup:

bash
# Backup world file
tar -czf ~/tshock/backups/world-$(date +%Y%m%d_%H%M).tar.gz \
  ~/tshock/worlds/MyWorld.wld

# Backup entire world directory
tar -czf ~/tshock/backups/full-$(date +%Y%m%d_%H%M).tar.gz \
  ~/tshock/worlds/

Restore from backup:

bash
systemctl stop terraria
tar -xzf ~/tshock/backups/world-20240101_1200.tar.gz -C ~/tshock/worlds/
systemctl start terraria

Automated backup every 4 hours:

bash
# Already configured in auto-backup section
# Verify it's running:
systemctl status cron
cat /etc/cron.d/terraria-backup

Ban and Kick Management

Ban/Unban via RCON:

bash
# In serverconfig.json, enable ServerQuery:
"ServerQueryEnabled": true,
"ServerQueryPort": 7777,

# Ban player by name
/ban PlayerName "Spam"

# Ban player by IP
/banip 192.168.1.100 "Griefing"

# View all bans
/banlist

# Unban player
/unban PlayerName

# Unban IP
/unbanip 192.168.1.100

Ban file location:

bash
# Bans stored in
~/tshock/tshock/bans.json

# Manual ban editing (dangerous)
nano ~/tshock/tshock/bans.json
systemctl restart terraria

Configuration Optimization

For small servers (1-10 players):

json
{
  "MaxSlots": 10,
  "ServerPort": 7777,
  "AutoSave": true,
  "BackupInterval": 120,
  "InvasionMultiplier": 1,
  "DefaultMaximumSpawns": 3
}

For large servers (50+ players):

json
{
  "MaxSlots": 100,
  "AutoSave": true,
  "BackupInterval": 60,
  "InvasionMultiplier": 0.5,
  "DefaultMaximumSpawns": 5,
  "RestApiEnabled": true,
  "RestApiPort": 7878
}

Monitoring Commands

bash
# Server status
systemctl status terraria

# Real-time logs
journalctl -u terraria -f

# Active connections
ss -tulnp | grep 7777

# Memory usage
ps aux | grep TShock.Server | grep -v grep

# World file size
ls -lh ~/tshock/worlds/

# Check backup status
ls -lh ~/tshock/backups/ | tail -5

Performance Tuning

Reduce lag on overcrowded servers:

json
{
  "DefaultMaximumSpawns": 3,        # Limit mob spawns
  "InvasionMultiplier": 0.5,        # Less frequent invasions
  "ServerPort": 7777,
  "MaxSlots": 50,                   # Don't overload
  "BackupInterval": 120,            # Less frequent saves
  "AnnounceSave": false              # Reduce spam
}

Monitor spawn rate:

bash
# Check server load
top -p $(pgrep -f TShock.Server)

# If CPU > 80%, reduce spawns in config:
# "DefaultMaximumSpawns": 2

Troubleshooting Common Issues

Server crashes:

Clients disconnect randomly:

High memory usage:

  • guest: Standard player
  • admin: Full control
  • moderator: Kick/ban, don't modify world
  • vip: Extra features (homes, warps)
  • GET /v3/players/info - Connected players
  • GET /v3/world/info - World details
  • POST /v3/players/kick - Kick player
  • POST /v3/world/save - Manual save
  • Increase RAM (check available with free -h)
  • Reduce max players
  • Disable heavy plugins
  • Check network: ss -tulnp | grep 7777
  • Verify firewall: sudo ufw allow 7777/tcp
  • Increase timeout in config
  • Restart server to clear: systemctl restart terraria
  • Reduce world complexity
  • Check for stuck backup processes: ps aux | grep tar

DeluxHost, opgericht in 2023, biedt hoogwaardige hostingoplossingen voor diverse digitale behoeften. Wij bieden gedeelde hosting, VPS en dedicated servers met geavanceerde beveiliging en wereldwijde datacenters.

© DeluxHost, Alle rechten voorbehouden. | BTW-nummer: IT17734661006
Alle systemen operationeel