How to Install a Factorio Server on Debian 11?
A Factorio server provides a shared space for multiplayer gaming. Also, it keeps running in the background to keep the game active even when players leave.
Wube Software developed this simulation game where you can build factories and manage resources.
The server needs stable internet and decent hardware for smooth gameplay. It runs on Linux and Debian 11 and provides stability and good performance for hosting the game. It is lightweight and reliable.
This article explains the step-wise process of installing the Factorio server on a Debian 11 cloud server with Wube Software’s official Linux server package.
Before installation, you need to have a Debian 11 cloud server deployed at Cantech. Also, update it to ensure everything is up to date.
You must create a non-root user with sudo privileges for security purposes.
Moreover, you will need a copy of the Factorio game to host the server.
Step 1 – Download the Factorio Server
- First, log in as the non-root user, and you must be in your home directory. Use the below command:
$ cd
- Now, you can download the latest version of the Factorio server package. Run the following command for the same with wget –
$ wget -O factorio.tar.xz https://www.factorio.com/get-download/latest/headless/linux64
- The downloaded file will be in a compressed format. Extract it using tar –
$ tar xJvf factorio.tar.xz
- After the extraction, change to the newly created directory with the command –.
$ cd factorio
Step 2 – Create a Save File
Factorio requires a save file to run. Upload an existing save file to the server or generate a new one.
- You can generate a new save file by first creating a directory for storing save files –
$ mkdir savegames
- Now, run the following command to create a new save file –
$ bin/x64/factorio --create ./savegames/world.zip
This will generate a new save file named world.zip inside the savegames folder.
Step 3 – Create a Configuration File
Factorio comes with a default configuration file. You can use it as a template for your server.
- You can start by making a copy of the default file –
$ cp data/server-settings.example.json server-settings.json
- Now, open the file in the editor to make any necessary changes.
$ nano server-settings.json
After that, read through the comments and modify the settings according to your preferences.
Step 4 – Firewall Configuration
Debian 11 uses the ufw firewall by default and blocks incoming connections.
You need to create a rule for the default port (34197) to allow connections to your Factorio server. If you have changed the port in the configuration file (server-settings.json), use the updated port number in the following ufw command as well.
$ sudo ufw allow 34197/udp
Reload the firewall to apply the changes after creating the rule.
$ sudo ufw reload
Run the below and check if the rule was added successfully –
$ sudo ufw status
Step 5 – Test the Server
You can now start the Factorio server for the first time.
To do this, use the following command –
$ bin/x64/factorio --start-server ./savegames/world.zip --server-settings ./server-settings.json
Next, connect it to your VPS’s IP address using the Factorio multiplayer menu to test it. You can find the IP address on Cantech’s control panel.
Stop the server by pressing Ctrl+C after testing.
Step 6 – Create a System Service for the Server
- Start by moving the Factorio files to the /opt directory:
$ sudo mv factorio /opt/
- Next, create a new user called factorio. It will run the server instead of using the root user.
$ sudo useradd factorio
- Change the ownership of the Factorio files to the factorio user –
$ sudo chown -R factorio:factorio /opt/factorio
- After that, switch to the factorio user –
$ sudo su factorio
- Test the new user by starting the Factorio server –
$ /opt/factorio/bin/x64/factorio --start-server /opt/factorio/savegames/world.zip --server-settings /opt/factorio/server-settings.json
- After the server starts without errors, stop it using Ctrl+C.
- Next, exit the factorio user account –
$ exit
- Create a service file for systemd with –
$ sudo nano /etc/systemd/system/factorio.service
Add the following content to the file:
[Unit] Description=Factorio Server After=network.target [Service] Type=simple Restart=always RestartSec=3 User=factorio ExecStart=/opt/factorio/bin/x64/factorio --start-server /opt/factorio/savegames/world.zip --server-settings /opt/factorio/server-settings.json [Install] WantedBy=multi-user.target
- Save the file and reload the systemd daemon:
$ sudo systemctl daemon-reload
- Enable the service with the below command so that it starts automatically on boot –
$ sudo systemctl enable factorio.service
- Start the service –
$ sudo systemctl start factorio.service
- Finally, you need to ensure everything works fine. For that, check the status of the service –
$ sudo systemctl status factorio.service
You can now test the server again by connecting to your VPS’s IP address. The server will start automatically when the VPS boots. To stop the server, you can use the following command:
$ sudo systemctl stop factorio.service
With all the steps complete, your server is all set up!