Author: Moritz Petzka • petzka.com • info@petzka.com
Unreal Engine dedicated Linux server as Docker container with included Django backend and database for admin tools and dynamic REST-API
- Headless Unreal Engine dedicated server
- Docker and Docker Compose support
- Persistent volume for saved data/logs
- Configurable map, port, and logging
- Minimal base image (Ubuntu 22.04)
- Docker and Docker Compose
- Access to Unreal Engine GitHub repository
- Linux or WSL with required build tools
# Unreal server
PROJECT_NAME=YourProjectName
UE_PORT=7777
UE_MAP=LobbyMap
UE_LOGGING=1
# Database settings
DB_NAME=uegame
DB_USER=admin
DB_PASSWORD=securepassword
# Optional: superuser for Django admin
CREATE_SUPERUSER=1
DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_EMAIL=admin@example.com
DJANGO_SUPERUSER_PASSWORD=admin123
# UnrealEngine Build
UNREAL_VERSION=5_6
BUILD_CONFIG=Shipping
PROJECT_DIR=UnrealProjects/YourProjectName
ARCHIVE_DIR=Packaged/YourProjectName
UNREAL_ENGINE_PATH=UnrealProjects/UnrealEngineUse Unreal Editor or automation tools to package your project as a Linux dedicated server, then place the output in the GameServer/ folder.
docker-compose builddocker-compose up -dThis will expose the server on port 7777 (UDP) and 15000 (TCP by default).
docker-compose downTo remove containers, networks, and volumes (careful with Saved/ data):
docker-compose down -vFile structure overview:
~/UnrealEngineGameServer/ # This respoitory
├── Saved/
├── logs/
├── UnrealProjects/ # Contains source code for project build
│ ├── UnrealEngine/
│ │ └── ...
│ ├── YourProjectName/
│ │ ├── Binaries/
│ │ ├── Content/
│ │ ├── Config/
│ │ ├── Source/
│ │ └── YourProjectName.uproject
In Linux (or use subsystem on windows), run:
sudo apt update
sudo apt install clang lld cmake make git build-essential libncurses5 libssl-dev libx11-dev \
libxcursor-dev libxinerama-dev libxrandr-dev libxi-dev libglib2.0-dev libpulse-dev \
libsdl2-dev mono-devel dos2unix unzip*(GitHub access to offical UnrealEngine repository needed )
mkdir -p ~/UnrealProjects
cd ~/UnrealProjects-
Option A: Clone UnrealEngine via SSH
git clone --depth=1 -b 5.6 git@github.com:EpicGames/UnrealEngine.git
-
Option B: Clone UnrealEngine via HTTP
git clone --depth=1 -b 5.6 https://github.com/EpicGames/UnrealEngine.git
cd ~/UnrealProjects/UnrealEngine
./Setup.sh
./GenerateProjectFiles.sh
makeThis builds the Unreal Engine Linux version in WSL. It will take a long time.
mkdir -p ~/UnrealProjects/YourProjectNameCopy your Windows project into this directory or clone from a repo
Calling engine build with the build accelerator disabled:
Engine/Build/BatchFiles/RunUBT.sh -NoUBTBuildAccelerator EpicWebHelper Linux Shipping
Engine/Build/BatchFiles/RunUBT.sh -NoUBTBuildAccelerator UnrealEditor Linux Development
sudo chmod +x Scripts/build.sh
sudo chmod +x Scripts/clean_build.sh
sudo chmod +x Scripts/gen_server_target.sh
sudo chmod +x Scripts/copy_project_files.sh
# Rebuild C++ code only (fast)
./Scripts/build.sh code
# Only blueprint changes
./Scripts/build.sh blueprints
# Full cook for content changes (no code changes)
./Scripts/build.sh content
# Build server binaries
./Scripts/build.sh server
# Full package (default)
./Scripts/build.sh full
# Clean build
./Scripts/clear_build.sh| Mode | Description | Cook | Build | Pak | Archive |
|---|---|---|---|---|---|
code |
C++ only, no cook/pak/archive | ❌ | ✅ | ❌ | ❌ |
blueprints |
Blueprint change only | ✅ | ❌ | ✅ | ❌ |
content |
Content-only changes | ✅ | ❌ | ✅ | ❌ |
server |
Server binaries only (new mode) | ❌ | ✅ | ❌ | ❌ (manual copy) |
full |
Full cook + pak + archive | ✅ | ✅ | ✅ | ✅ |
YourProjectNameServer is auto-generated when you enable Dedicated Server support.
Ensure you have bUsesSteam=false (if you're not configuring Steam) in DefaultEngine.ini under OnlineSubsystem.
./Scripts/gen_server_target.shThis creates a file like:
// YourProjectNameServer.Target.cs
using UnrealBuildTool;
using System.Collections.Generic;
public class YourProjectNameServerTarget : TargetRules
{
public YourProjectNameServerTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Server;
DefaultBuildSettings = BuildSettingsVersion.V2;
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_6;
ExtraModuleNames.Add("YourProjectName");
}
}Run the following in your project folder, e.g.:
cd ~/UnrealProjects/YourProjectNameThen delete the following folders:
rm -rf Binaries/ Intermediate/ DerivedDataCache/ Saved/~/UnrealProjects/UnrealEngine/Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh \
-project="$(pwd)/YourProjectName.uproject" -gameClean Build Cache (Optional if Build Breaks or Conflicts)
cd ~/UnrealProjects/YourProjectName
# Remove cached build files
rm -rf Binaries/ Intermediate/ DerivedDataCache/ Saved/
# Optional: Clean Unreal's build state
./UnrealProjects/UnrealEngine/Engine/Binaries/DotNET/UnrealBuildTool.exe -Clean
docker-compose down
docker-compose up --buildIf you're just rebuilding code and not changing content:
./UnrealProjects/UnrealEngine/Engine/Binaries/DotNET/UnrealBuildTool.exe -Clean
rm -rf Saved Intermediate DerivedDataCache
docker-compose down
docker-compose up --build(DjangoBackend/config/entities.json)
{
"Player": {
"fields": {
"username": "CharField(max_length=50, unique=True)",
"email": "EmailField()",
"score": "IntegerField(default=0)",
"is_active": "BooleanField(default=True)"
}
},
"Match": {
"fields": {
"match_id": "CharField(max_length=32, unique=True)",
"start_time": "DateTimeField()",
"end_time": "DateTimeField(null=True, blank=True)",
"winner": "ForeignKey('Player', on_delete=models.DO_NOTHING, null=True)"
}
},
... add more fields if needed
}-
e.g.
Compile Module.GeometryCollectionEngine.2.cpp In file included from /home/<username>/UnrealEngineGameServer/UnrealProjects/UnrealEngine/Engine/Intermediate/Build/Linux/x64/UnrealEditor/Development/GeometryCollectionEngine/Module.GeometryCollectionEngine.2.cpp:19: /home/jodermo/UnrealEngineGameServer/UnrealProjects/UnrealEngine/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionSceneProxy.cpp:43:10: fatal error: 'GeometryCollectionSceneProxy.ispc.generated.h' file not found 43 | #include "GeometryCollectionSceneProxy.ispc.generated.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.Install ispc
cd ~/Downloads
wget https://github.com/ispc/ispc/releases/download/v1.21.0/ispc-v1.21.0-linux.tar.gz
tar -xvzf ispc-v1.21.0-linux.tar.gz cd ispc-v1.21.0-linux
sudo cp bin/ispc /usr/local/bin/
ispc --version
mkdir -p ~/UnrealEngineGameServer/UnrealProjects/UnrealEngine/Engine/Binaries/ThirdParty/Linux/ISPC cp bin/ispc ~/UnrealEngineGameServer/UnrealProjects/UnrealEngine/Engine/Binaries/ThirdParty/Linux/ISPC/
echo 'export PATH=$HOME/UnrealEngineGameServer/UnrealProjects/UnrealEngine/Engine/Binaries/ThirdParty/Linux/ISPC:$PATH' >> ~/.bashrc source ~/.bashrc
ls -l Engine/Binaries/ThirdParty/Linux/ISPC/ispc chmod +x Engine/Binaries/ThirdParty/Linux/ISPC/ispc
```
You need to add the additional libraries to your build environment
sudo apt-get update && sudo apt-get install -y \
libglib2.0-0 \
libsm6 \
libice6 \
libxcomposite1 \
libxrender1 \
libfontconfig1 \
libxss1 \
libxtst6 \
libxi6
# recommendation
./Engine/Build/BatchFiles/Linux/Build.sh UnrealEditor Linux Development -ForceSingleThread
find Engine/Intermediate -name "*.ispc.generated.h"
# other options
rm -rf Engine/Intermediate/Build/Linux/x86_64/UnrealEditor/Development/Chaos
./Engine/Build/BatchFiles/Linux/Build.sh UnrealEditor Linux Development -SingleFile
find Engine/Intermediate -name "*.ispc.generated.h"
rm -rf Engine/Intermediate
rm -rf Engine/Binaries/Linux
export UE_BUILD_DISABLE_ISPC=1
./Scripts/build.sh full
rm -rf Engine/Intermediate Engine/Binaries/Linux
./Scripts/build.sh full