Technology Encyclopedia Home >How to Run a Terraria Server on a Cloud Server — Multiplayer World Always Online

How to Run a Terraria Server on a Cloud Server — Multiplayer World Always Online

Terraria hit-and-run multiplayer — where someone hosts from their computer and everyone disconnects when they do — misses what makes the game great. The world should persist. Your friend should be able to log on Tuesday morning and continue building while you're at work.

A cloud server keeps the world running around the clock. The server requirements are modest — Terraria's dedicated server is one of the lightest in the genre — so even a small VPS plan handles it comfortably.

The one thing to know before starting: you need to create a world file before the server can start. I'll cover that clearly in the setup.

This guide sets up a Terraria dedicated server on Ubuntu 22.04 — Terraria provides a native Linux server binary that doesn't require SteamCMD.

I run game servers on Tencent Cloud Lighthouse. Terraria is lightweight — the entry-level plan (2 vCPU / 2 GB RAM) runs a Terraria server comfortably, which makes it one of the most cost-effective dedicated game servers to self-host. The global data center coverage ensures you can find a region with low latency for your friend group, and the fixed monthly pricing means hosting a persistent world costs a predictable amount regardless of how many hours you play.


Table of Contents

  1. Server Requirements
  2. Prerequisites
  3. Part 1 — Server Setup
  4. Part 2 — Download Terraria Dedicated Server
  5. Part 3 — Create Server Configuration
  6. Part 4 — Run with Screen (Quick Test)
  7. Part 5 — Run as systemd Service
  8. Part 6 — Open Firewall Ports
  9. Part 7 — Connect from the Game
  10. Part 8 — World and Backups
  11. The Gotcha: World File Must Exist Before Server Starts
  12. Server Console Commands

  • Key Takeaways
  • Use the appropriate Lighthouse application image to skip manual installation steps where available
  • Lighthouse snapshots provide one-click full-server backup before major changes
  • OrcaTerm browser terminal lets you manage the server from any device
  • CBS cloud disk expansion handles growing storage needs without server migration
  • Console-level firewall + UFW = two independent protection layers

Server Requirements {#requirements}

Terraria is one of the most resource-efficient game servers available:

Players RAM CPU
1–8 512 MB 1 vCPU
8–16 1 GB 1–2 vCPU
16+ 2 GB 2 vCPU

The Starter plan (2 GB RAM) handles a Terraria server plus other applications simultaneously.


Prerequisites {#prerequisites}

Requirement Notes
Cloud server Tencent Cloud Lighthouse Ubuntu 22.04
1 GB+ RAM Very lightweight server
Terraria on Steam Players need the game client

Cost: The Starter plan (~$5–6/month) is plenty for Terraria. Check current promotions.


Part 1 — Server Setup {#part-1}

ssh ubuntu@YOUR_SERVER_IP
sudo apt update && sudo apt upgrade -y

# Create a dedicated user
sudo adduser --disabled-password --gecos "" terraria
sudo su - terraria

Part 2 — Download Terraria Dedicated Server {#part-2}

Check the current version at terraria.org and on the Terraria GitHub releases page or the official download:

# As terraria user
mkdir ~/terraria-server && cd ~/terraria-server

# Download the dedicated server (check terraria.org for latest version number)
# Official server download link format:
wget https://terraria.org/api/download/pc-dedicated-server/terraria-server-1449.zip

# Extract
unzip terraria-server-1449.zip
mv 1449/Linux/* .
chmod +x TerrariaServer.bin.x86_64

exit   # Back to ubuntu user

Part 3 — Create Server Configuration {#part-3}

sudo -u terraria nano /home/terraria/terraria-server/serverconfig.txt
# World file path
world=/home/terraria/.local/share/Terraria/Worlds/MyWorld.wld

# World to auto-load (if exists)
# autocreate=1   (1=Small, 2=Medium, 3=Large)
# worldname=MyWorld

# Server settings
port=7777
maxplayers=8
motd=Welcome to My Terraria Server!

# Password (leave empty for no password)
password=

# Difficulty: 0=Classic, 1=Expert, 2=Master, 3=Journey
difficulty=0

# Language (en/de/it/fr/es/ru/zh/pt/pl)
language=en

# NPC friendly fire
npcstream=60

# Priority (0-5, higher = more CPU)
priority=1

Part 4 — Run with Screen (Quick Test) {#part-4}

sudo apt install -y screen

# Switch to terraria user and test
sudo su - terraria
screen -S terraria
cd ~/terraria-server

./TerrariaServer.bin.x86_64 -config /home/terraria/terraria-server/serverconfig.txt

If the world file doesn't exist, you'll get an interactive prompt to create one. Follow the prompts:

  1. Choose world size (1=Small, 2=Medium, 3=Large)
  2. Enter world name
  3. Choose difficulty

The world generates (takes 1-2 minutes), then the server starts.

Detach from screen: Ctrl+A D
Re-attach: screen -r terraria

exit   # Back to ubuntu user

Part 5 — Run as systemd Service {#part-5}

sudo nano /etc/systemd/system/terraria.service
[Unit]
Description=Terraria Dedicated Server
After=network.target

[Service]
Type=simple
User=terraria
WorkingDirectory=/home/terraria/terraria-server
ExecStart=/home/terraria/terraria-server/TerrariaServer.bin.x86_64 \
  -config /home/terraria/terraria-server/serverconfig.txt
Restart=on-failure
RestartSec=10s

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable terraria
sudo systemctl start terraria

sudo journalctl -u terraria -f
# Wait for: Server started

Part 6 — Open Firewall Ports {#part-6}

sudo ufw allow 7777/tcp    # Terraria default port
sudo ufw allow ssh
sudo ufw enable

Open the same in Lighthouse console firewall.


Part 7 — Connect from the Game {#part-7}

In Terraria:

  1. Multiplayer → Join via IP
  2. Enter server IP: YOUR_SERVER_IP
  3. Port: 7777
  4. Enter password (if configured)

Or in Terraria: Multiplayer → Find Server (searches for servers via Steam).


Part 8 — World and Backups {#part-8}

World files are stored at:

/home/terraria/.local/share/Terraria/Worlds/

Backup:

sudo nano ~/backup_terraria.sh
#!/bin/bash
BACKUP_DIR=/home/ubuntu/backups/terraria
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p $BACKUP_DIR

sudo systemctl stop terraria
sleep 3

sudo tar czf $BACKUP_DIR/terraria_world_$DATE.tar.gz \
  /home/terraria/.local/share/Terraria/Worlds/

sudo systemctl start terraria

find $BACKUP_DIR -mtime +7 -delete
echo "Terraria backup: $DATE"
chmod +x ~/backup_terraria.sh
(crontab -l; echo "0 5 * * * ~/backup_terraria.sh") | crontab -

The Gotcha: World File Must Exist Before Server Starts {#gotcha}

If you configure a specific world path in serverconfig.txt but the world doesn't exist there, the server hangs waiting for interactive input — it can't start as a non-interactive systemd service.

Solution: create the world first using interactive mode (as shown in Part 4), then configure the systemd service to use that world file path.

Alternatively, use the autocreate setting in serverconfig.txt:

autocreate=2       # Create a medium world if it doesn't exist
worldname=MyWorld  # World will be saved as MyWorld.wld
world=/home/terraria/.local/share/Terraria/Worlds/MyWorld.wld

With autocreate, the server generates the world automatically on first start — no interactive input needed.


Server Console Commands {#commands}

Terraria server console commands (accessible while the process is running, or via RCON):

help            - List all commands
playing         - Show online players
kick PlayerName - Kick a player
ban PlayerName  - Ban a player
password        - Change or show password
motd            - Change the message of the day
time            - Show or set in-game time
dawn / noon / dusk / midnight - Set in-game time
save            - Save the world
exit-nosave     - Shutdown without saving
exit            - Save and shutdown

Troubleshooting {#troubleshooting}

Issue Likely Cause Fix
Connection refused Service not running or wrong port Check systemctl status SERVICE and verify firewall rules
Permission denied Wrong file ownership or permissions Check file ownership with ls -la and use chown/chmod to fix
502 Bad Gateway Backend service not running Restart the backend service; check logs with journalctl -u SERVICE
SSL certificate error Certificate expired or domain mismatch Run sudo certbot renew and verify domain DNS points to server IP
Service not starting Config error or missing dependency Check logs with journalctl -u SERVICE -n 50 for specific error
Out of disk space Logs or data accumulation Run df -h to identify usage; clean logs or attach CBS storage
High memory usage Too many processes or memory leak Check with htop; consider upgrading instance plan if consistently high
Firewall blocking traffic Port not open in UFW or Lighthouse console Open port in Lighthouse console firewall AND sudo ufw allow PORT

Frequently Asked Questions {#faq}

What server size do I need for a Terraria server?
Check the requirements section in this guide. Generally: more RAM = more players. Start with the recommended specs and monitor actual usage with htop before scaling up.

How do I keep the Terraria server running when I close my SSH session?
Use screen, tmux, or systemd to run the server as a background process. The guide covers setting up a systemd service for automatic startup and crash recovery.

How do I update the Terraria server software?
Stop the server, download the new version, replace the old binary or files, and restart. Always back up your world/save data first. Check the game's official documentation for version-specific migration notes.

How do I protect my server from unwanted players?
Use password protection and/or whitelist mode (if supported). Restrict the server port in UFW to known IP addresses if it's a private server for a small group.

What region should I choose for the server?
Choose the Lighthouse data center closest to where most of your players are located. Latency is directly tied to geographic distance from the server.

Run your Terraria server:
👉 Tencent Cloud Lighthouse — Lightweight VPS for Terraria
👉 View current pricing and promotions
👉 Explore all active deals and offers