
Dig, fight, explore, build! Nothing is impossible in this action-packed adventure game.
Here's what you need to run a Terraria dedicated server.
Small server, 1-4 players
Medium server, 4-8 players
Large server, 8-16 players
Start hosting from your own computer
Run a Terraria server on your desktop, laptop, VPS, or dedicated machine — GameCP automates Docker setup, resource allocation, and Terraria configuration instantly. Automatic port forwarding means your friends can connect without touching your router. Start local, scale to a VPS when you're ready.
Skip the manual installation, port forwarding, and configuration. Install on your own computer and start hosting instantly.
The full manual process to host a Terraria dedicated server on a VPS. Or install GameCP on your own computer and skip all of this.
Set your server settings, then install Docker, and pull the Terraria container image.
# Update system and install Docker sudo apt update && sudo apt install -y docker.io sudo systemctl enable --now docker # Create game server directory sudo mkdir -p /opt/gameserver # Server configuration export MAX_PLAYERS="8" export SERVER_MOTD="Welcome!" export WORLD_NAME="world" export WORLD_SIZE="1" export WORLD_DIFFICULTY="3" export NPCSTREAM="0" export TERRARIA_VERSION="latest" # Pull the container image docker pull ghcr.io/ptero-eggs/yolks:debian
Terraria uses a custom install script to download and configure the server files.
#!/bin/bash
# Vanilla Installation Script
#
# Server Files: /opt/gameserver
## install packages to get version and download links
apt update
apt install -y curl wget file unzip jq
DOWNLOAD_LINK=invalid
mkdir -p /opt/gameserver/
cd /opt/gameserver/
if [ "${TERRARIA_VERSION}" == "latest" ] || [ "${TERRARIA_VERSION}" == "" ] ; then
V=$(curl -sSL https://terraria.org/api/get/dedicated-servers-names | jq -r .[] | head -1)
DOWNLOAD_LINK="https://terraria.org/api/download/pc-dedicated-server/${V}"
else
CLEAN_VERSION=$(echo ${TERRARIA_VERSION} | sed 's/\.//g')
echo -e "Downloading terraria server files"
DOWNLOAD_LINK=$(curl -sSL https://terraria.wiki.gg/wiki/Server#Downloads | grep '>Terraria Server ' | grep -Eoi '<a [^>]+>' | grep -Eo 'href=\"[^\\\"]+\"' | grep -Eo '(http|https):\/\/[^\"]+' | grep "${CLEAN_VERSION}" | cut -d'?' -f1)
fi
## this is a simple script to validate a download url actaully exists
echo ${DOWNLOAD_LINK}
if [ ! -z "${DOWNLOAD_LINK}" ]; then
if curl --output /dev/null --silent --head --fail ${DOWNLOAD_LINK}; then
echo -e "link is valid."
else
echo -e "link is invalid closing out"
exit 2
fi
fi
CLEAN_VERSION=$(echo ${DOWNLOAD_LINK##*/} | cut -d'-' -f3 | cut -d'.' -f1)
echo -e "running 'curl -sSL ${DOWNLOAD_LINK} -o ${DOWNLOAD_LINK##*/}'"
curl -sSL ${DOWNLOAD_LINK} -o ${DOWNLOAD_LINK##*/}
echo -e "Unpacking server files"
unzip ${DOWNLOAD_LINK##*/}
echo -e ""
cp -R ${CLEAN_VERSION}/Linux/* ./
chmod +x TerrariaServer.bin.x86_64
echo -e "Cleaning up extra files."
rm -rf ${CLEAN_VERSION}
echo -e "Generating config file"
cat <<EOF > serverconfig.txt
worldpath=/opt/gameserver/saves/Worlds
worldname=default
world=/opt/gameserver/saves/Worlds/default.wld
difficulty=3
autocreate=1
port=7777
maxplayers=8
EOF
mkdir -p /opt/gameserver/saves/Worlds
echo -e "Install complete"Terraria requires 1 port to be open for game traffic and queries.
sudo ufw allow 7777/tcp
Start the Terraria server using the configuration from Step 1.
docker run -d \ --name terraria-server \ -p 7777:7777/tcp \ -e MAX_PLAYERS="8" \ -e SERVER_MOTD="Welcome!" \ -e WORLD_NAME="world" \ -e WORLD_SIZE="1" \ -e WORLD_DIFFICULTY="3" \ -e NPCSTREAM="0" \ -e TERRARIA_VERSION="latest" \ -v /opt/gameserver:/opt/gameserver \ -w /opt/gameserver \ ghcr.io/ptero-eggs/yolks:debian \ ./TerrariaServer.bin.x86_64 -config serverconfig.txt
GameCP automates every step above: Docker, port forwarding, startup, and config. Install on your own PC and deploy a Terraria server in under 5 minutes.
Deploy with GameCPExplore step-by-step setup guides for other popular games supported by GameCP.
Install GameCP on your own computer and start hosting in minutes. Automatic port forwarding, zero config — your friends connect instantly.
No credit card required · Free tier available · Install local, scale later