Factorio is a popular game that involves building and maintaining factories on an alien planet. In this article, we will explain how to install a Factorio server on Debian 11.
Before we begin, it’s important to note that this tutorial assumes that you already have a Debian 11 system up and running, and that you are logged in as a user with sudo privileges.
Install the Required Utilities
To install a Factorio server on Debian 11, you will need to download the server files from the Factorio website and extract them to the desired location on your system. To do this, you will need the wget
and unzip
utilities, which are not installed by default on Debian 11. To install these utilities, run the following command:
sudo apt-get install wget unzip
Download and Extract the Server Files
Once the required utilities are installed, you can download and extract the Factorio server files by running the following commands:
wget -O factorio-latest.zip <https://www.factorio.com/get-download/latest/headless/linux64>
unzip factorio-latest.zip
This will download the latest version of the Factorio server files as a .zip
archive, and will extract them to a directory called factorio
.
Create a Dedicated User for the Server
It’s recommended to run the Factorio server as a dedicated user, instead of using the root
user or your regular user account. This will ensure that the server has the appropriate permissions and is isolated from other processes on your system.
To create a new user for the Factorio server, run the following command:
sudo adduser --system --group factorio
This will create a new system user called factorio
, and will also create a new group with the same name.
Grant Ownership of the Server Files to the factorio
User
Now that the factorio
user has been created, you need to grant ownership of the Factorio server files to this user. To do this, run the following command:
sudo chown -R factorio:factorio /path/to/factorio
Replace /path/to/ with the actual path to the **
factorio`** directory where the server files were extracted.
Create a Systemd Service File for the Server
To run the Factorio server as a service, you need to create a systemd service file that defines how the server should be started and stopped. To do this, create a new file called factorio.service
in the /etc/systemd/system
directory:
sudo touch /etc/systemd/system/factorio.service
Next, open the factorio.service
file in a text editor:
sudo nano /etc/systemd/system/factorio.service
And add the following content to the file:
[Unit]
Description=Factorio Server
After=network.target
[Service]
User=factorio
Group=factorio
Nice=1
ExecStart=/path/to/factorio/bin/x64/factorio --start-server /path/to/factorio/saves/
[Install]
WantedBy=multi-user.target
Replace /path/to/factorio
with the actual path to the factorio
directory where the server files were extracted.
Once you have added the content to the factorio.service
file, save the file and close the text editor.
Start the Server
Now that the factorio.service
file has been created, you can start the Factorio server by running the following command:
sudo systemctl start factorio
This will start the Factorio server and make it available to connect to from the network.
Enable the Server to Start Automatically on Boot
To make the Factorio server start automatically whenever the system is restarted, you can enable the factorio
service by running the following command:
sudo systemctl enable factorio
This will ensure that the Factorio server is always running and available, even after a system restart.
In conclusion, installing a Factorio server on Debian 11 is a simple process that involves downloading and extracting the server files, creating a dedicated user for the server, and creating a systemd service file to manage the server. By following the steps outlined in this article, you can easily set up a Factorio server on your Debian 11 system and start playing the game with your friends.