Terraria
| Platform | Support | Notes |
|---|---|---|
| Linux | ✅ Native | Via 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.
Requirements
| Component | Minimum |
|---|---|
| RAM | 1 GB |
| CPU | 1 core |
| Disk | 1 GB |
| OS | Ubuntu 22.04 / Debian 12 |
| Port | 7777 TCP |
Installation with TShock (recommended)
TShock is the Terraria server with plugins, permissions and admin commands. It's used by almost all public servers.
# 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
First Run and Configuration
# 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.
Startup Script
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
systemd Service
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
Firewall
ufw allow 7777/tcp
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
Configuration serverconfig.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
}
TShock Plugins
Plugin .dll files go in the ServerPlugins/ folder:
# 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
Automatic Backup
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
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:
| Permission | Effect |
|---|---|
tshock.admin | All permissions |
tshock.world.time.set | Change time |
tshock.world.time.get | See time |
tshock.player.usewarp | Use warps |
tshock.player.sethome | Set home point |
tshock.npc.hurttown | Harm town NPCs |
tshock.god | God mode access |
tshock.kill.cyclopse | Kill specific NPC |
REST API and ServerQuery
Access server programmatically:
# 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 Size | Recommended RAM | Notes |
|---|---|---|
| Small | 512 MB | 10-15 players |
| Medium | 1 GB | 20-30 players |
| Large | 2 GB | 50+ players |
| Journey's End (large) | 3+ GB | 100+ players |
# 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 /):
# 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:
# 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:
systemctl stop terraria
tar -xzf ~/tshock/backups/world-20240101_1200.tar.gz -C ~/tshock/worlds/
systemctl start terraria
Automated backup every 4 hours:
# 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:
# 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:
# 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):
{
"MaxSlots": 10,
"ServerPort": 7777,
"AutoSave": true,
"BackupInterval": 120,
"InvasionMultiplier": 1,
"DefaultMaximumSpawns": 3
}
For large servers (50+ players):
{
"MaxSlots": 100,
"AutoSave": true,
"BackupInterval": 60,
"InvasionMultiplier": 0.5,
"DefaultMaximumSpawns": 5,
"RestApiEnabled": true,
"RestApiPort": 7878
}
Monitoring Commands
# 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:
{
"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:
# 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
Articoli correlati
CS2
How to install and configure a Counter-Strike 2 dedicated server on Linux VPS with SteamCMD
Palworld
Create a dedicated Palworld server on Linux with SteamCMD. Configuration, ports and automatic startup.
Rust
Install and manage a Rust server (Facepunch) on Linux with SteamCMD. Includes automatic updates, Oxide plugins and optimizations.
