Factorio headless

Some notes, not neccessarily enough to set it up yourself, but for me to remember.

ssh root@[IP]
apt update
apt upgrade
dpkg-reconfigure --priority=low unattended-upgrades
adduser factorio
mkdir /opt/factorio
chown factorio:factorio /opt/factorio
su - factorio
wget https://www.factorio.com/get-download/1.1.72/headless/linux64
mv linux64 factorio.tar.xz
tar xvf factorio.tar.xz
mv factorio/* /opt/factorio/
rmdir factorio
rm factorio.tar.xz
cd /opt/factorio
./bin/x64/factorio --start-server

Printed out how to. Looks like start-server needs a link to a zip-file which is the save. This is the most interesting options:

--start-server FILE
--server-settings FILE
--server-whitelist FILE
--use-server-whitelist
--server-adminlist FILE
--console-log FILE
--server-id FILE

Let’s create a new save.

./bin/x64/factorio --create ./saves/test.zip

And then run

./bin/x64/factorio --start-server ./saves/test.zip --server-settings ./data/server-settings.json --server-adminlist ./data/server-adminlist.json

And we’re able to join and play!

Create a systemd config

[Unit]
Description=Factorio

[Service]
WorkingDirectory=/opt/factorio/
User=factorio
Group=factorio
Restart=always
ExecStart=/opt/factorio/bin/x64/factorio --start-server-load-latest --server-settings ./data/server-settings.json --server-adminlist ./data/server-adminlist.json

[Install]
WantedBy=multi-user.target

And run

systemctl enable factorio
systemctl start factorio

TODO

RCON?

Send new users to slack

Send chat to slack