Factorio has an official headless server for Linux: no graphics, small, and designed to run on a server. A dedicated server keeps your factory running for everyone, handles players joining at different times, and avoids lag from a player hosting on their own PC. Factorio’s deterministic simulation means single-thread CPU speed sets how big a factory can get before slowing down (UPS drops).

Requirements

  • 2 vCPU and 2–4 GB RAM for most games. Megabases and big mod packs (Space Age, Krastorio, Space Exploration) need more RAM and a fast CPU.
  • UDP port 34197.
  • A location with low latency to your players. Factorio multiplayer is latency-sensitive. See game server VPS.

Install the headless server

sudo adduser --disabled-password --gecos "" factorio
sudo -iu factorio
wget -O factorio_headless.tar.xz https://factorio.com/get-download/stable/headless/linux64
tar -xJf factorio_headless.tar.xz      # creates ~/factorio

The headless server is free to download and doesn’t need a game licence on the server. Players need their own copies.

Create a save and settings

cd ~/factorio
cp data/server-settings.example.json data/server-settings.json
./bin/x64/factorio --create saves/world.zip                 # default map settings
# or customised:
# ./bin/x64/factorio --create saves/world.zip --map-gen-settings data/map-gen-settings.json --map-settings data/map-settings.json

Edit data/server-settings.json:

{
  "name": "Our Factory",
  "description": "Friends only",
  "visibility": { "public": false, "lan": false },
  "username": "",
  "token": "",
  "game_password": "secret-pass",
  "require_user_verification": true,
  "max_players": 0,
  "autosave_interval": 10,
  "autosave_slots": 5,
  "afk_autokick_interval": 0,
  "auto_pause": true
}
  • To list the server publicly, set "public": true, and add your factorio.com username and token (from your profile page).
  • auto_pause pauses the game when nobody is online.

Admins and whitelist

echo '["YourFactorioName"]' > ~/factorio/server-adminlist.json
echo '["YourFactorioName","FriendName"]' > ~/factorio/server-whitelist.json

Start with --server-adminlist server-adminlist.json and --use-server-whitelist --server-whitelist server-whitelist.json. Admins can use /promote, /kick, /ban and /save in game.

Start the server

./bin/x64/factorio --start-server saves/world.zip \
  --server-settings data/server-settings.json \
  --server-adminlist server-adminlist.json

Use --start-server-load-latest instead to load the newest save (including autosaves) automatically.

systemd service

# /etc/systemd/system/factorio.service
[Unit]
Description=Factorio Headless Server
After=network-online.target

[Service]
User=factorio
WorkingDirectory=/home/factorio/factorio
ExecStart=/home/factorio/factorio/bin/x64/factorio --start-server-load-latest --server-settings data/server-settings.json --server-adminlist server-adminlist.json
Restart=on-failure
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload && sudo systemctl enable --now factorio
journalctl -u factorio -f

SIGINT makes Factorio save before exiting. See systemd unit files.

Firewall

sudo ufw allow 34197/udp

RCON (optional, for remote admin commands) uses --rcon-port 27015 --rcon-password …. Don’t open it publicly. See UFW.

Mods

  • Put mod .zip files and mod-list.json into ~/factorio/mods/. The easiest way is to copy them from a client that has the same mods enabled.
  • Players are offered the server’s mods automatically when they join.
  • Server and client versions (game and mods) must match.

Performance (UPS) tips

Factorio targets 60 updates per second (UPS). When the server can’t keep up, everyone’s game slows down.

  • Watch the server’s CPU with htop. One core at 100% means you’ve hit the single-thread limit. See htop.
  • Big factories cost UPS: fewer, larger belts and trains, fewer inserters and biters (or turn pollution and expansion down in the map settings).
  • Faster CPU cores help more than extra cores. If a megabase outgrows the VPS, move to a plan or server with higher clock speeds.

Updates

Download the new headless tarball, and extract it over the old one (your saves, mods and config files stay), or use a script such as factorio-updater. Back up first. Major versions can change mods and saves.

Backups

Factorio’s autosaves rotate (autosave_slots), but they live on the same disk:

tar czf /backups/factorio-$(date +%F-%H%M).tgz -C /home/factorio/factorio saves

Copy backups off-site. See backup strategy.

Quick reference

Item Value
Port 34197/udp
Create save factorio --create saves/world.zip
Start factorio --start-server-load-latest --server-settings …
Settings data/server-settings.json
Clean stop SIGINT (saves the game)

Related: Satisfactory dedicated server and LinuxGSM.

  • Game Server
  • Linux
  • Self-Hosting