Setting Up a Dedicated Factorio Server: A Comprehensive Guide

Factorio1.9k views22 favorites2 min readby GhostwheelUpdated Jan 26, 2025View on Steam ↗

Introduction

Hosting a dedicated Factorio server allows for a persistent game world that players can join at any time. This setup is beneficial for continuous gameplay and managing larger groups of players.

Prerequisites

- System Requirements: Ensure your system meets the necessary hardware requirements to run a Factorio server smoothly.
- Network Configuration: Factorio uses UDP port 34197 by default. Ensure this port is open and forwarded in your router settings to allow external connections.

Setting Up on Windows

- Download Factorio:
- Visit the Factorio Downloads page[www.factorio.com] and download the latest version suitable for your system.

- Extract Files:
- Extract the downloaded files to a directory of your choice, e.g., C:\\FactorioServer.

- Create a Save File:
- Launch Factorio, set up your desired game settings, and save the game.
- Place the save file in the saves folder within your Factorio directory.

- Configure the Server:
- Navigate to the data folder and locate server-settings.example.json.
- Copy and rename it to server-settings.json.
- Edit this file to configure server settings such as name, description, and password.

- Create a Batch File to Start the Server:
- In the Factorio directory, create a new text file named start-server.bat.
- Add the following line, replacing YourSaveFile.zip with the name of your save file:
start factorio.exe --start-server saves\\YourSaveFile.zip --server-settings data\\server-settings.json
- Save and run this batch file to start your server.

Setting Up on Linux

- Update System Packages:
- Open a terminal and run:
sudo apt update && sudo apt upgrade -y

- Create a User for Factorio:
- It's advisable to run the server under a dedicated user:
sudo adduser --disabled-login --no-create-home --gecos factorio factorio

- Download and Extract Factorio:
- Navigate to /opt and download the headless server:
cd /opt sudo wget -O factorio_headless.tar.gz https://www.factorio.com/get-download/latest/headless/linux64 sudo tar -xzf factorio_headless.tar.gz sudo rm factorio_headless.tar.gz

- Set Permissions:
- Assign ownership to the Factorio user:
sudo chown -R factorio:factorio /opt/factorio

- Configure the Server:
- Similar to the Windows setup, edit the server-settings.json file located in /opt/factorio/data.

- Create a Systemd Service:
- Create a service file for Factorio:
sudo nano /etc/systemd/system/factorio.service
- Add the following content:
[Unit] Description=Factorio Headless Server After=network.target [Service] User=factorio WorkingDirectory=/opt/factorio ExecStart=/opt/factorio/bin/x64/factorio --start-server /opt/factorio/saves/YourSaveFile.zip --server-settings /opt/factorio/data/server-settings.json Restart=on-failure [Install] WantedBy=multi-user.target
- Enable and start the service:
sudo systemctl enable factorio sudo systemctl start factorio

Example Batch Scripts

- Windows Batch Script (start-server.bat):
@echo off cd /d "C:\\FactorioServer" start factorio.exe --start-server saves\\YourSaveFile.zip --server-settings data\\server-settings.json

- Linux Shell Script (start-server.sh):
#!/bin/bash cd /opt/factorio ./bin/x64/factorio --start-server saves/YourSaveFile.zip --server-settings data/server-settings.json
Ensure the script has execution permissions:
chmod +x start-server.sh

Additional Tips

- Mod Support: To add mods, place them in the mods folder within your Factorio directory.
- Backups: Regularly back up your save files to prevent data loss.
- Troubleshooting: Check logs for errors and ensure all required ports are open for external connections.

---

By following this guide, you can set up and manage a dedicated Factorio server with ease, ensuring smooth multiplayer gameplay for you and your friends. Happy building!

This guide was created by its original author on the Steam Community. Are you the author and want it removed? Request removal.