
FiveM is a modification for Grand Theft Auto V enabling you to play multiplayer on customized dedicated servers.
Here's what you need to run a FiveM dedicated server.
Small server, 1-16 players
Medium server, 16-48 players
Large server, 48-128 players
Start hosting from your own computer
Run a FiveM server on your desktop, laptop, VPS, or dedicated machine — GameCP automates Docker setup, resource allocation, and FiveM 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 FiveM 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 FiveM 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="32" export STEAM_WEBAPIKEY="none" export FIVEM_VERSION="recommended" export TXADMIN_ENABLE="1" # Pull the container image docker pull ghcr.io/ptero-eggs/yolks:debian
FiveM uses a custom install script to download and configure the server files.
#!/bin/bash
# FiveM Installation Script
#
# Server Files: /opt/gameserver
apt update -y
apt install -y tar xz-utils file jq
mkdir -p /opt/gameserver/resources
cd /opt/gameserver
echo "updating citizenfx resource files"
git clone https://github.com/citizenfx/cfx-server-data.git /tmp
cp -Rf /tmp/resources/* resources/
RELEASE_PAGE=$(curl -sSL https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/)
CHANGELOGS_PAGE=$(curl -sSL https://changelogs-live.fivem.net/api/changelog/versions/linux/server)
if [[ "${FIVEM_VERSION}" == "recommended" ]] || [[ -z ${FIVEM_VERSION} ]]; then
DOWNLOAD_LINK=$(echo $CHANGELOGS_PAGE | jq -r '.recommended_download')
elif [[ "${FIVEM_VERSION}" == "latest" ]]; then
DOWNLOAD_LINK=$(echo $CHANGELOGS_PAGE | jq -r '.latest_download')
else
VERSION_LINK=$(echo -e "${RELEASE_PAGE}" | grep -Eo '".*/*.tar.xz"' | grep -Eo '".*/*.tar.xz"' | sed 's/\"//g' | sed 's/\.\///1' | grep -i "${FIVEM_VERSION}" | grep -o =.* | tr -d '=')
if [[ "${VERSION_LINK}" == "" ]]; then
echo -e "defaulting to recommedned as the version requested was invalid."
DOWNLOAD_LINK=$(echo $CHANGELOGS_PAGE | jq -r '.recommended_download')
else
DOWNLOAD_LINK=$(echo https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/${VERSION_LINK})
fi
fi
if [ ! -z "${DOWNLOAD_URL}" ]; then
if curl --output /dev/null --silent --head --fail ${DOWNLOAD_URL}; then
echo -e "link is valid. setting download link to ${DOWNLOAD_URL}"
DOWNLOAD_LINK=${DOWNLOAD_URL}
else
echo -e "link is invalid closing out"
exit 2
fi
fi
echo -e "Running curl -sSL ${DOWNLOAD_LINK} -o ${DOWNLOAD_LINK##*/}"
curl -sSL ${DOWNLOAD_LINK} -o ${DOWNLOAD_LINK##*/}
echo "Extracting fivem files"
FILETYPE=$(file -F ',' ${DOWNLOAD_LINK##*/} | cut -d',' -f2 | cut -d' ' -f2)
if [ "$FILETYPE" == "gzip" ]; then
tar xzvf ${DOWNLOAD_LINK##*/}
elif [ "$FILETYPE" == "Zip" ]; then
unzip ${DOWNLOAD_LINK##*/}
elif [ "$FILETYPE" == "XZ" ]; then
tar xvf ${DOWNLOAD_LINK##*/}
else
echo -e "unknown filetype. Exiting"
exit 2
fi
rm -rf ${DOWNLOAD_LINK##*/} run.sh
if [ -e server.cfg ]; then
echo "Skipping downloading default server config file as one already exists"
else
echo "Downloading default fivem config"
curl https://raw.githubusercontent.com/ptero-eggs/game-eggs/main/gta/fivem/server.cfg >>server.cfg
fi
# Create txAdmin data directories and seed config
mkdir -p txData/default
if [ ! -f txData/default/config.json ]; then
echo '{"version": 2, "serverDataPath": "/opt/gameserver", "serverEndpoint": "0.0.0.0:30120"}' > txData/default/config.json
echo "txAdmin config.json created"
else
echo "txAdmin config.json already exists, skipping"
fi
echo "txAdmin data directory ready"
mkdir -p logs/
echo "install complete"FiveM requires 2 ports to be open for game traffic and queries.
sudo ufw allow 30120/both sudo ufw allow 40120/tcp
Start the FiveM server using the configuration from Step 1.
Create the startup script
# Create the startup script cat > /opt/gameserver/start.sh << 'EOF' #!/bin/bash # FiveM Server Startup # Export txAdmin Host Mode environment variables export TXHOST_DATA_PATH=/txData export TXHOST_MAX_SLOTS=32 export TXHOST_TXA_PORT= export TXHOST_FXS_PORT=30120 export TXHOST_DEFAULT_CFXKEY= SERVER_BIN="/alpine/opt/cfx-server/FXServer" if [ ! -f "" ]; then echo "ERROR: FiveM server binary not found at " exit 1 fi echo "Starting FiveM server..." /alpine/opt/cfx-server/ld-musl-x86_64.so.1 \ --library-path "/alpine/usr/lib/v8/:/alpine/lib/:/alpine/usr/lib/:/alpine/opt/cfx-server/lib/" \ -- /alpine/opt/cfx-server/FXServer \ +set citizen_dir /alpine/opt/cfx-server/citizen/ \ EOF chmod +x /opt/gameserver/start.sh
Run the container
docker run -d \ --name fivem-server \ -p 30120:30120/both \ -p 40120:40120/tcp \ -e MAX_PLAYERS="32" \ -e STEAM_WEBAPIKEY="none" \ -e FIVEM_VERSION="recommended" \ -e TXADMIN_ENABLE="1" \ -v /opt/gameserver:/opt/gameserver \ -w /opt/gameserver \ ghcr.io/ptero-eggs/yolks:debian \ ./start.sh
GameCP automates every step above: Docker, port forwarding, startup, and config. Install on your own PC and deploy a FiveM 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