name@localhost:~/type sudo adduser factorio
name@localhost:~/type sudo passwd factorio
after you created the user for the server. type su - factorio
factorio@localhost:~/
Next we going to open a port up of 34197.
if you use "UFW" then you know how to open it up, for those do not know how to open it up type this.
Code: Select all
ufw allow 34197/udp
Code: Select all
ufw status verbose
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if you use firewall-cmd then you type;
Code: Select all
firewall-cmd --zone=public --permanent --add-port=34197/udp
Code: Select all
firewall-cmd --zone=public --list-ports
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Iptables:
Type in this:
Code: Select all
iptables -A INPUT -p udp --dport 34197 -j ACCEPT
Code: Select all
iptables -L
Code: Select all
sudo cd /sbin
then type
Code: Select all
./iptables-save
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOW Installation:
we are going to install screen.
type:
name@localhost:~/
Code: Select all
apt-get install screen
Code: Select all
wget https://factorio.com/get-download/0.15.40/headless/linux64
example:
Code: Select all
cp linux64 factorio.tar.xz
Code: Select all
cp linux64 factorio.tar.gz
Code: Select all
tar -xf factorio.tar.gz
Code: Select all
tar -xf factorio.tar.xz
Example:
Code: Select all
-rw-rw-r-- 1 factorio factorio 2298 Feb 24 23:13 achievements.dat
drwxrwxr-x 3 factorio factorio 4096 Feb 24 23:09 bin
drwxrwxr-x 2 factorio factorio 4096 Feb 24 23:13 config
-rw-r--r-- 1 factorio factorio 998 Aug 7 2015 config-path.cfg
drwxr-xr-x 4 factorio factorio 4096 Feb 24 23:34 data
drwxrwxr-x 2 factorio factorio 4096 Feb 24 23:46 factorio
-rw-rw-r-- 1 factorio factorio 4260 Feb 24 23:46 factorio-current.log
-rw-rw-r-- 1 factorio factorio 6608 Feb 24 23:38 factorio-previous.log
-rw-rw-r-- 1 factorio factorio 19816272 Feb 24 23:09 factorio.tar.xz
drwxrwxr-x 2 factorio factorio 4096 Feb 24 23:46 mods
-rw-rw-r-- 1 factorio factorio 299 Feb 24 23:46 player-data.json
drwxrwxr-x 2 factorio factorio 4096 Feb 24 23:46 saves
-rw-rw-r-- 1 factorio factorio 119 Feb 24 23:36 server-id.json
-rwxrwxr-x 1 factorio factorio 137 Feb 24 23:43 start.sh
drwxrwxr-x 2 factorio factorio 4096 Feb 24 23:46 temp
Code: Select all
sudo chown -R factorio:factorio /home/factorio
Now to create a save file:
Note: This will create a map save in /home/factorio/saves/ as server-save.zip
cd /factorio/bin/x64
it would show you something like factorio@localhost:~/factorio/bin/x64$
then type this below
Code: Select all
./factorio --create /home/factorio/saves/server-save
head over to /home/factorio/data/ and some coping file to file. here is an example
Code: Select all
cp server-settings.example.json server-settings.json
Code: Select all
cp map-settings.example.json map-settings.json
Code: Select all
cp server-whitelist.example.json server-whitelist.json
Code: Select all
cp map-gen-settings.example.json map-gen-settings.json
also same for the other Json files if you like.
now to start the server you have can do it in a couple of ways..
one way is by typing it in the command prompt
type cd /bin/x64
then type
Code: Select all
./factorio --start-server-load-latest --server-settings /home/factorio/data/server-settings.json
type nano/vim start.sh
then type at the first line
Code: Select all
#!/bin/bash
Code: Select all
#!/bin/sh
Code: Select all
screen -S Fact /home/factorio/bin/x64/factorio --start-server-load-latest --server-settings /home/factorio/data/server-settings.json
then type
Code: Select all
chmod +x start.sh
Code: Select all
./start.sh
if you want to work on the config.ini in the config directory you can just need to add the line at the end of ./factorio --config /home/factorio/config/config.ini
also if you want to read up more on factorio command lines just head over to the /home/factorio/bin/x64 directory and type ./factorio --help, it will give you a list of commands to use.
I sure hope this does help a little for everybody that is just starting Ubuntu server.
Enjoy this small tutorial.
Rikor420