[UE4] Build DedicatedServer on Windows and Linux

I want to build a DedicatedServer on Linux! So, make a note of what I tried variously

This article

Check the operation in Windows environment

First, let's check that it works on the editor 3aa51d51363dc4d28f0666adec0ef373.png [Selected Viewport] x [Standalone Game] x [Play Offline] x [Play As Client] x [Number of Players] I will check the operation of each of these combinations, so it's quite Taihen. ..

Launch from outside the editor

If you start it with PIE, you can trace all server and client processes. This is convenient, but if you follow a function that is called CLI1, CLI2, SERV multiple times (BeginPlay, etc.), your head will get very tired (!). Describes how to start processes individually

Server startup batch


:: [UE4DIR], [ProjectName]Replace with your own environment
set EDITOR=[UE4DIR]\Engine\Binaries\Win64\UE4Editor.exe
set GAME_UPROJECT=%~dp0%\[ProjectName].uproject

::Optional launch map
::The default is the project settings[Server Default Map]Is used

::Start the server from the editor
start %EDITOR% %GAME_UPROJECT% %MAP_NAME% -server -log

Client launch batch


set EDITOR=[UE4DIR]\Engine\Binaries\Win64\UE4Editor.exe
set GAME_UPROJECT=%~dp0%\[ProjectName].uproject

start %EDITOR% %GAME_UPROJECT% -game -log -windowed -ResX=1024 -ResY=576

Build & Cook

Next, I will describe binary creation

Add server build target

The target file does not exist in the template, so add it


using UnrealBuildTool;
using System.Collections.Generic;

public class [ProjectName]ServerTarget : TargetRules
	public [ProjectName]ServerTarget(TargetInfo Target) : base(Target)
		Type = TargetType.Server;
		DefaultBuildSettings = BuildSettingsVersion.V2;

Please add by referring to [ProjectName] .Target.cs in the same directory. f68f1206877201067ff5f8a5447ff97d.png After adding the file, update the VS file from the uproject menu fe585b7fa7855b8e8fd1051443f87961.png Make sure you have more targets (VSCode image)

Cook from the command line

There are many tutorials on ProjectLauncher when you google, It is not necessary to start the editor, so it is recommended to execute it from a batch file.


set GAME_UPROJECT=%~dp0%\[ProjectName].uproject

::If one line is long^Line break with
::If you enter start, the window will remain at the end
start %ENGINE_ROOT%\Build\BatchFiles\RunUAT ^
	BuildCookRun -project=%GAME_UPROJECT% ^
	-nop4 -build -cook -compressed -stage ^
	-noclient -server -serverplatform=Win64 -serverconfig=Development ^
	-pak -utf8output

81ebb694a18fef878a21e358c28aa9b5.png When BUILD SUCCESSFUL is displayed, it is complete. Packages will be generated under [ProjectDir] \ Saved \ StagedBuilds \ Windows Server 8809a9e877f3aba2b910de72065c3448.png Open the folder in explorer and type cmd to open a command prompt on the fly (I didn't know) 23068bc0dedb39a92461bce3bbeafccb.png Run the exe with the -log argument to start the server 3c40660160da2ba816bbf74857911da6.png You can connect to the server by launching PIE, pressing the @ key, and typing [open].

Build a Linux environment

Read Linux Cross-Compiling first. Did you read it? What should I do··· Should I build in a Linux environment in the first place? You thought so! !! !! 679e03840b5a525aee093506fb20d543.png When I tried to create a P4 environment and submitted and updated UE4DIR, it looked like this, so I was scared and stopped. When you hit Setup, it's about 120GB, so ... the volume isn't enough in the first place ... Building Unreal Engine Game Client and Dedicated Server on Linux There are people who are doing it, but what kind of operation is it?

That's why build on Windows-> transfer only executable files

Toolchain installation

aacfa4ee36e3060455da770db2f9b489.png Clicking link does not start the installation, but Right-click-> Open new window to install Run Generate Visual Studio project files again and Linux should be added to the target (I don't have confidence in the details around here ...)

Linux server cook

Change -serverplatform in BuildServer.bat to Linux and build & cook Success if packaged in \ Saved \ StagedBuilds \ LinuxServer

Build an AWS server

It's not the main subject so only the main points

Start the server

$ ./[ProjectName]Server.sh -log

I will try to execute the command for the time being,

./[ProjectName]Server.sh: line 5:  2950 Segmentation fault
"$UE4_PROJECT_ROOT/[ProjectName]/Binaries/Linux/[ProjectName]Server" [ProjectName] "[email protected]"

start gdb debugger

$ gdb [ProjectName]Server
GNU gdb (GDB) Red Hat Enterprise Linux 8.0.1-30.amzn2.0.3
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from [ProjectName]Server...Reading symbols from /var/www/[ProjectName]/Binaries/Linux/[ProjectName]Server.debug...done.
(gdb) run -log
Starting program: /var/www/[ProjectName]/Binaries/Linux/[ProjectName]Server -log
fork: Cannot allocate memory.

Cannnnnnnnnot allocate memory!!! So I changed from t3nano to t3micro and was able to start up safely Confirm that you can connect with [open ###. ###. ###. ### (GlobalIP)]

Start in the background with nohup

//Grant execute permission to start with nohup
$ chmod +x SlothServer.sh
//standard/Change the error output as appropriate
//MapName is optional (if not specified)[Server Default Map])
$ nohup ./SlothServer.sh [MapName] > nohup.out 2> nohup.err &

kill nohup boot process

$ pkill SlothServer

Reference link

How To Set Up Dedicated Servers for Windows and Linux For Your UE4 Game (using Windows) Legacy/Dedicated Server Guide (Windows & Linux)

Recommended Posts

[UE4] Build DedicatedServer on Windows and Linux
Build and install OpenCV on Windows
Install wsl2 and master linux on windows
Linux (WSL) on Windows
Build TensorFlow on Windows
Build XGBoost on Windows
Build Linux on a Windows environment. Steps to install Laradock and migrate
Recording and playback on Linux
Build Python environment on Windows
Build Apache HTTP Server and Wildfly on Oracle Linux 8
Build python environment on windows
Linux on Windows -1-: debian introduction
Use Linux on Windows 10 (WSL2)
Install LAMP on Amazon Linux 2 and build a WordPress environment.
Differences between Windows and Linux directories
Python 3.6 on Windows ... and to Xamarin.
(Windows10) Install Linux environment and gnuplot.
WSL2 ~ Linux on Windows ~ (Part 1: Introduction)
Integrate Modelica and Python on Windows
Create a Linux environment on Windows 10
Mastering pip and wheel on windows
pykintone on Windows Subsystem for Linux
Install easy_install and pip on windows
Build a 64-bit Python 2.7 environment with TDM-GCC and MinGW-w64 on Windows 7
Python 2.7, 3.4, 3.5 extension module build environment on Windows
docker and PyCharm under proxy on windows
Build Python3 and OpenCV environment on Ubuntu 18.04
Build an NFS server on Arch Linux
Build a simple WebDAV server on Linux
Install and launch k3s on Manjaro Linux
Build an LNPP environment on Amazon Linux 2
Install and Configure TigerVNC server on Linux
Learn sshd_config and authorized_keys (on Amazon Linux 2)
Build a Samba server on Arch Linux
Run py.test on Windows Anaconda and MinGW
Arch on lvm on luks build and initialization
Create a Linux virtual machine on Windows
Replacing rmtrash on Mac and replacing rm on Linux
Put MeCab binding for Python with pip on Windows, mac and Linux
Install and run Python3.5 + NumPy + SciPy on Windows 10
Open a ZIP created on Windows in Linux
Python on Windows
(Windows) Causes and workarounds for UnicodeEncodeError on Python 3
Simply build a Python 3 execution environment on Windows
Notes on installing Python3 and using pip on Windows7
[Samba] File sharing between Linux and Windows machines
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
Cross-compile windows version from nim on arch | linux
Organize files on Windows with Linux commands-using WSL-
Build Oracle Database 19c on Oracle Linux 8.3 (DB Build Part 2)
Invert screen output vertically and horizontally on linux
Linux (Bash) and Windows (PowerShell) command correspondence table
How to build Java environment on Ubuntu (Linux)
[Note] Installing Python 3.6 + α on Windows and RHEL
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux and build a Web server ―― 1. Apache introduction
Build an Arch Linux environment on Raspberry Pi
Install ZIP version Python and pip on Windows 10
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux and build a Web server --2 PHP introduction
Steps to build PyTorch 1.5 for CUDA 10.2 on Windows
Build a server on Linux and local network with Raspberry Pi NextCloud and desktop sharing
Install procs, an alternative tool for ps, on Linux (also available on Mac and Windows)