r/factorio•
goofy183

Install & Configure Factorio on Linux

I've had several requests for a follow on post to Factorio Server on Google Cloud with steps to actually download and configure Factorio. Lucky for you all I just re-built my factorio server last night and grabbed everything I did from my bash history:

All of the instructions here assume you have sudo access to the machine you are doing this install on. More specifically these are the steps I followed to setup my Google Compute Engine server.

  1. ssh to the machine you are going to be using.
  2. I find being able to do sudo -u easier than doing sudo su so first thing is to makes sure I have that permission.
  • sudo visudo
  • Change ALL=NOPASSWD: ALL entries to ALL=(ALL) NOPASSWD: ALL using the editor that comes up
  • Save the changes (usually ctrl+x then answer Y at the prompt for the default editor nano)
  1. Create a factorio user, this is the user that will run the server and own the related files
  • sudo useradd factorio
  1. We will install everything in /opt
  • cd /opt
  1. Download the factorio-init script
  • sudo git clone https://github.com/Bisa/factorio-init.git
  1. Download the factorio-updater script
  • sudo git clone https://github.com/narc0tiq/factorio-updater.git
  1. Download & extract the factorio server. Get the latest stable or experimental download link.
  • sudo wget https://www.factorio.com/get-download/0.13.13/headless/linux64
  • EDIT: Login credentials are now required to download the headless server. You now need to go to https://www.factorio.com/download-headless/experimental manually download the file and then transfer it to your server via scp.
  • sudo tar -xzvf linux64
  • sudo rm linux64
  1. Everything we just did is currently owned by root, we want the factorio user to actually own everything so change the owner user and group for everything factorio related under /opt
  • sudo chown -R factorio:factorio /opt/factorio*
  1. Install & Configure the factorio-init script
  • sudo -u factorio cp /opt/factorio-init/config.example /opt/factorio-init/config
  • sudo cp /opt/factorio-init/factorio.service.example /etc/systemd/system/factorio.service
  • sudo -u factorio vim /opt/factorio-init/config
    • Change the following settings:
    • UPDATE_SCRIPT=/opt/factorio-updater/update_factorio.py
    • UPDATE_USERNAME=yourfactoriousername (put in your factorio.com user name)
    • Comment out the UPDATE_TOKEN line (put a # at the start of the line)
    • Set UPDATE_EXPERIMENTAL to 1 if you want to use the experimental builds instead of stable.
  1. Configure factorio
  • sudo -u factorio cp /opt/factorio/data/server-settings.example.json /opt/factorio/data/server-settings.json
  • sudo -u factorio vim /opt/factorio/data/server-settings.json
    • Set the name, description, and tags to whatever values you want. These are used to help people find the server.
    • IF you want to use the factorio matching server (browse public games) set username and password to your factorio.com username and password
    • Set a game_password unless you want anyone to be able to join your server
    • I personally have verify_user_identity set to false as I run a password protected server for friends I trust. I believe setting this false would let a malicious actor spoof their player name and play as other users.
  1. Manually launch the server for initialization and to create the first save
  • sudo -u factorio /opt/factorio/bin/x64/factorio --create /opt/factorio/saves/
  1. Verify the server starts
  • sudo systemctl start factorio
  • sudo systemctl status -l factorio
  • Remember to enable the service at startup if you want that:
    • sudo systemctl enable factorio

From here on out you can follow the (factorio-init)[https://github.com/Bisa/factorio-init/blob/master/README.md#systemd] help docs on how to start/stop/update the server. Running sudo -u factorio /opt/factorio-init/factorio will also give a list of commands that the script can run for you.

With this setup the factorio server should start when the server boots and gracefully stop when the server shuts down. This is really handy if you want to pinch pennies and only run your GCE server when you actually play on it.

Posted Aug 3, 2016, 5:15 PM UTC · edited

3415
Loading comments…