Technology Encyclopedia Home >How to Deploy a Factorio Server on a VPS — Automated Factory Gaming, Always On

How to Deploy a Factorio Server on a VPS — Automated Factory Gaming, Always On

Factorio multiplayer has a particular dynamic: the factory never stops. Trains keep running, belts keep moving, and the pollution cloud keeps expanding even when no one is logged in. That only makes sense on a dedicated server that stays online.

I've been in a Factorio multiplayer playthrough that ran for months, with people joining and leaving as schedules allowed. That kind of long-running campaign only works reliably with a cloud server hosting the world.

Factorio's dedicated server is officially supported and well-documented by the developer. This guide deploys it on Ubuntu 22.04, including the headless download that doesn't require Steam to install.

I run Factorio servers on Tencent Cloud Lighthouse. The 2 vCPU / 4 GB RAM plan handles early-to-mid game sessions with 4-8 players well; larger factories benefit from 4 vCPU. The spec upgrade path is useful for Factorio specifically — you can start with a smaller plan and upgrade as the factory grows and demands more CPU, without re-provisioning the server or losing your world. The snapshot feature is essential before major factory expansions or when installing mods that modify existing blueprints.


Table of Contents

  1. Server Requirements
  2. Prerequisites
  3. Part 1 — Server Setup
  4. Part 2 — Download Factorio Headless Server
  5. Part 3 — Create a New World or Use an Existing Save
  6. Part 4 — Configure Server Settings
  7. Part 5 — Run as systemd Service
  8. Part 6 — Open Firewall Ports
  9. Part 7 — Connect from the Game
  10. Part 8 — Backups
  11. The Gotcha: UPS Drop Means Factory Is Running Too Complex
  12. Admin Commands

  • Key Takeaways
  • Use the appropriate Lighthouse application image to skip manual installation steps where available
  • Lighthouse snapshots provide one-click full-server backup before major changes
  • OrcaTerm browser terminal lets you manage the server from any device
  • CBS cloud disk expansion handles growing storage needs without server migration
  • Console-level firewall + UFW = two independent protection layers

Server Requirements {#requirements}

Factory Stage RAM CPU
Early game (up to first rocket) 2 GB 2 vCPU
Mid-megabase 4 GB 2–4 vCPU
Large megabase 8 GB 4+ vCPU

Factorio's server is single-threaded for the game simulation — more cores don't help the factory calculation speed. What matters is CPU clock speed.


Prerequisites {#prerequisites}

Requirement Notes
Cloud server Tencent Cloud Lighthouse Ubuntu 22.04
4 GB RAM Recommended even for small servers
A Factorio account For downloading the headless server binary

Part 1 — Server Setup {#part-1}

ssh ubuntu@YOUR_SERVER_IP
sudo apt update && sudo apt upgrade -y

sudo adduser --disabled-password --gecos "" factorio
sudo su - factorio

Part 2 — Download Factorio Headless Server {#part-2}

The Factorio headless server is free to download — you don't need to own the game on the server. Players connecting do need to own Factorio.

# As factorio user
# Check https://factorio.com/download for latest version
FACTORIO_VERSION="2.0.28"

wget "https://factorio.com/get-download/${FACTORIO_VERSION}/headless/linux64" \
  -O factorio-headless.tar.xz

tar -xJf factorio-headless.tar.xz
ls factorio/
# bin/, config/, data/, mods/, saves/, etc.

exit   # Back to ubuntu user

Part 3 — Create a New World or Use an Existing Save {#part-3}

Option A: Generate a new world

sudo -u factorio /home/factorio/factorio/bin/x64/factorio \
  --create /home/factorio/factorio/saves/myworld.zip

Option B: Use an existing save

Copy your save file to the server:

scp myworld.zip ubuntu@YOUR_SERVER_IP:/tmp/
sudo cp /tmp/myworld.zip /home/factorio/factorio/saves/
sudo chown factorio:factorio /home/factorio/factorio/saves/myworld.zip

Option C: Generate with custom map settings

# First, generate a map-gen-settings template
sudo -u factorio /home/factorio/factorio/bin/x64/factorio \
  --create /home/factorio/factorio/saves/myworld.zip \
  --map-gen-settings /home/factorio/factorio/data/map-gen-settings.example.json

Part 4 — Configure Server Settings {#part-4}

# Copy example config files
sudo -u factorio cp /home/factorio/factorio/data/server-settings.example.json \
  /home/factorio/factorio/config/server-settings.json

sudo -u factorio nano /home/factorio/factorio/config/server-settings.json

Key settings:

{
  "name": "My Factorio Server",
  "description": "Private server for friends",
  "tags": ["game", "tags"],

  "max_players": 10,
  "visibility": {
    "public": false,
    "lan": true
  },

  "username": "",
  "password": "",
  "token": "",

  "game_password": "optionalpassword",

  "require_user_verification": true,
  "autosave_interval": 10,
  "autosave_slots": 5,
  "afk_autokick_interval": 0,
  "allow_commands": "admins-only",

  "admins": ["YourFactorioUsername"]
}

For a private server, set "public": false. For a public server, provide your Factorio account username/token for server listing.


Part 5 — Run as systemd Service {#part-5}

sudo nano /etc/systemd/system/factorio.service
[Unit]
Description=Factorio Dedicated Server
After=network.target

[Service]
Type=simple
User=factorio
WorkingDirectory=/home/factorio/factorio
ExecStart=/home/factorio/factorio/bin/x64/factorio \
  --start-server /home/factorio/factorio/saves/myworld.zip \
  --server-settings /home/factorio/factorio/config/server-settings.json \
  --port 34197
Restart=on-failure
RestartSec=15s

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable factorio
sudo systemctl start factorio

sudo journalctl -u factorio -f
# Watch for: Factorio initialised

Part 6 — Open Firewall Ports {#part-6}

sudo ufw allow 34197/udp    # Factorio default port
sudo ufw allow ssh
sudo ufw enable

Open the same in the Lighthouse console firewall.


Part 7 — Connect from the Game {#part-7}

In Factorio:

  1. Play → Multiplayer → Connect to address
  2. Enter: YOUR_SERVER_IP:34197
  3. Enter game password if set

Part 8 — Backups {#part-8}

Factorio auto-saves to saves/ every 10 minutes (configurable). For off-server backups:

sudo nano ~/backup_factorio.sh
#!/bin/bash
BACKUP_DIR=/home/ubuntu/backups/factorio
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p $BACKUP_DIR

# Copy all saves (Factorio auto-saves while running, so no stop needed)
sudo tar czf $BACKUP_DIR/factorio_saves_$DATE.tar.gz \
  /home/factorio/factorio/saves/

find $BACKUP_DIR -mtime +7 -delete
echo "Factorio backup: $DATE"
chmod +x ~/backup_factorio.sh
(crontab -l; echo "0 * * * * ~/backup_factorio.sh") | crontab -

The Gotcha: UPS Drop Means Factory Is Running Too Complex {#gotcha}

Factorio runs at 60 updates per second (UPS). When the server can't keep up, UPS drops below 60 — the game slows down for all players.

Symptoms: the game feels like it's in slow motion, or players report the game "running at 0.5x speed."

This is purely CPU load from the factory simulation. Solutions:

  1. Reduce pollution and biters — disable or reduce enemy settings
  2. Limit beacon/module density — fewer combinators and circuit networks
  3. Upgrade server plan — more CPU clock speed
  4. Split the factory — multiple players on separate smaller saves

Monitor UPS in-game: press F5 to show debug info including UPS.


Admin Commands {#commands}

Connect to the server console (in-game as admin, or via stdin):

/admins                    - List admins
/promote PlayerName        - Promote to admin
/demote PlayerName         - Remove admin
/ban PlayerName reason     - Ban player
/unban PlayerName          - Unban player
/kick PlayerName reason    - Kick player
/players                   - List online players
/c game.speed = 0.5        - Slow down time (cheats)
/c game.speed = 2          - Speed up time
/c game.player.print(...)  - Custom Lua commands
/save filename             - Save to specific file

Troubleshooting {#troubleshooting}

Issue Likely Cause Fix
Connection refused Service not running or wrong port Check systemctl status SERVICE and verify firewall rules
Permission denied Wrong file ownership or permissions Check file ownership with ls -la and use chown/chmod to fix
502 Bad Gateway Backend service not running Restart the backend service; check logs with journalctl -u SERVICE
SSL certificate error Certificate expired or domain mismatch Run sudo certbot renew and verify domain DNS points to server IP
Service not starting Config error or missing dependency Check logs with journalctl -u SERVICE -n 50 for specific error
Out of disk space Logs or data accumulation Run df -h to identify usage; clean logs or attach CBS storage
High memory usage Too many processes or memory leak Check with htop; consider upgrading instance plan if consistently high
Firewall blocking traffic Port not open in UFW or Lighthouse console Open port in Lighthouse console firewall AND sudo ufw allow PORT

Frequently Asked Questions {#faq}

What server size do I need for a Factorio server?
Check the requirements section in this guide. Generally: more RAM = more players. Start with the recommended specs and monitor actual usage with htop before scaling up.

How do I keep the Factorio server running when I close my SSH session?
Use screen, tmux, or systemd to run the server as a background process. The guide covers setting up a systemd service for automatic startup and crash recovery.

How do I update the Factorio server software?
Stop the server, download the new version, replace the old binary or files, and restart. Always back up your world/save data first. Check the game's official documentation for version-specific migration notes.

How do I protect my server from unwanted players?
Use password protection and/or whitelist mode (if supported). Restrict the server port in UFW to known IP addresses if it's a private server for a small group.

What region should I choose for the server?
Choose the Lighthouse data center closest to where most of your players are located. Latency is directly tied to geographic distance from the server.

Run your factory server:
👉 Tencent Cloud Lighthouse — CPU-optimized VPS for Factorio
👉 View current pricing and promotions
👉 Explore all active deals and offers