Pre-launch.NetCraftGames is not accepting customers yet. Launch happens only after its public checks pass.See launch statusJoin the waitlist

Guides

How to build a Linux dedicated server from Unity

In Unity 6, open File > Build Profiles, add the Linux Server platform, switch to the profile and build. The result is a headless executable. Then make it listen on 0.0.0.0, test it on Linux and pack it as a clean .tar.gz.

By Charging Bull SoftwareLast updated:

The short answer

Unity builds a dedicated server as a sub-target of the desktop platforms. In Unity 6 you add a Linux Server build profile, switch to it and press Build. Unity strips audio, textures, meshes, shaders and rendering code that a headless server does not need, which cuts size, memory and CPU use. The output is a Linux x86-64 executable with a data folder.

Before you build

  • Install the module. If the Linux Server platform is missing from the Platform Browser, choose Install with Unity Hub and add the Linux Dedicated Server module for your editor version.
  • Separate server code from client code. Dedicated Server builds define the UNITY_SERVER scripting symbol, so you can write #if UNITY_SERVER to start networking and skip UI, audio and input.
  • Use a fixed port and bind all interfaces. A server bound to 127.0.0.1 is invisible to the world.
  • Plan for logs and exit codes. A server that quits silently is hard to diagnose. Log startup errors to standard output.

Build steps

  1. Open Build ProfilesIn the Unity Editor choose File > Build Profiles.
  2. Add the Linux Server platformSelect Add Build Profile to open the Platform Browser and choose Linux Server. If it is not listed, select Install with Unity Hub and add the module for your editor version.
  3. Switch to the profileSelect Switch Profile so the new profile becomes active. A Dedicated Server build is a headless executable with no graphical interface.
  4. Set server behavior in codeUse #if UNITY_SERVER to start your networking in server mode, bind to 0.0.0.0 and a fixed port, and skip UI, audio and input setup.
  5. BuildSelect Build and choose an empty output folder. Keep the whole folder, since the executable needs its data directory.
  6. Test on Linux and packRun it headless on Linux, join from another machine, set the executable bit, then archive the folder with tar -czf server.tar.gz . with no symbolic links or secrets inside.

Test the build the way a host will run it

On a Linux x86-64 machine or container, extract the archive and run the server with the same arguments you will declare:

mkdir game && tar -xzf server.tar.gz -C game
chmod +x game/UnityServer.x86_64
./game/UnityServer.x86_64 -batchmode -nographics

In a second terminal check that the port is open (ss -lunp for UDP, ss -ltnp for TCP) and join with a client from another machine. If the server exits immediately, read its log; exit code 127 usually means a missing library or the wrong architecture, and 139 a crash inside the program.

Common mistakes

MistakeSymptomFix
Built the Windows server by accident"No Linux x86-64 program found"Check the profile says Linux Server and the file type is ELF 64-bit x86-64
Bound to 127.0.0.1Port open locally, unreachable remotelyListen on 0.0.0.0
Executable bit lostExit code 126chmod +x before packing
Secrets in the buildUpload rejectedRead tokens from environment variables
Server waits for a display or inputHangs at startupGuard with #if UNITY_SERVER or -batchmode
Built on a newer Linux than the hostThe code reading holds the build for glibcThe worker image has glibc 2.39 (Ubuntu 24.04); build there or in an ubuntu:24.04 container
Declared Mirror or NGO for a game with its own socketsA non-blocking advisory says no Mirror or Netcode assembly was foundDeclare Custom native TCP/UDP (direct) and supply a join probe

Next

Pick the networking page that matches you: Unity Mirror or Unity NGO, then use the ports and firewall checklist. If your server uses neither and speaks its own TCP or UDP protocol, read the custom native section of the manifest guide: a direct, limited lane where you supply the join probe.

Frequently asked questions

Can I build a Linux server from Windows?

Yes. Install the Linux Dedicated Server module for your editor version with Unity Hub, add the Linux Server profile in Build Profiles and build from your Windows machine. You still need a Linux machine or container to test it, because a build that starts on Windows tooling may fail on Linux libraries or permissions.

Sources