
Factorio is a simulation game developed by Wube Software that lets you build and maintain factories. This guide shows you how to download, install, and configure a Factorio server on a Debian 11 cloud server, using the official Linux server package provided by Wube Software.
To use the Factorio server, you also need your own copy of the game.
Log in as the non-root user.
Make sure you are in your user's home directory.
Download the latest version of the Factorio server package.
The file downloaded is in a compressed format. Decompress it using tar.
Change to the newly extracted folder.
The Factorio server requires a save file. You can upload your own save file to the server if you already have one. Or, uses these steps to generate a new save file on the server.
Create a new directory to store the save files.
Run the factorio binary using the --create flag to generate a new save file. If you have already uploaded your own save file, you can skip this step.
This generates a new save file called world.zip in the savegames folder.
Factorio includes a default server configuration file, which you can use as a template.
Make a copy of the default file.
Edit the new configuration file.
You should read the comments in the configuration file and make any changes you need for your server.
Debian 11 has the ufw firewall enabled by default, which blocks connections from the internet. You need to create a new firewall rule to allow connections on the Factorio server's default port. If you changed the default port in the server-settings.json file, you need to change it in the ufw allow command too.
Reload ufw to apply the new rule.
Check the status of ufw. It should list your newly created firewall rule.
If you are using a Vultr Firewall on your VPS, you need to create a similar rule in the Vultr Firewall control panel.
You're now ready to start the server for the first time. After the server has started, you can test it by connecting to your VPS's IP address in the Factorio multiplayer menu. You can find the IP address on the Instances tab in the Vultr control panel.
After you've finished testing the server, stop it using Ctrl+C.
Creating a system service allows you to start and stop the Factorio server using systemctl commands. It also starts the server automatically when your VPS boots.
Make sure you are in your user account's home directory.
Move the Factorio server files to /opt.
Create a new user called factorio. You will use this account to run the Factorio server, instead of running it as the root user.
Set the new factorio user as the owner of all files in the /opt/factorio directory.
Switch to the factorio user.
Test the new user account by starting the Factorio server. Check the output and look for any errors.
If there are no errors, your new user account is working. Stop the server using Ctrl+C. You can now switch back to your own user account.
Create a new service file. This tells systemd how to execute the new service.
Paste in the following configuration:
After saving the file, reload the systemd daemon to make sure that it detects the new service.
Enable the service, so that it starts at boot.
Start the service.
Check the status of the service to ensure that the Factorio server started correctly.
You can now connect your Factorio client to the VPS's IP address to test the server again. The server will start automatically when your VPS boots. If you need to stop the server, you can use the systemctl stop command.
In this article, you installed a Factorio server and set it up to run as a system service. You can learn more about how to run a Factorio multiplayer server on the Factorio website.
0 Comments
Be the first to comment and share your perspective with the community.