Ubuntu 16.04 Lts Dedicated Server Setup
Posted: Sun Feb 25, 2018 5:46 am
Connect to your ssh account using Putty, as root or another user with root access.
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.
then type
you should see 34197/udp listed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if you use firewall-cmd then you type;
then type:
This will give you a list of ports are open in your command window.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Iptables:
Type in this:
To check to see if the port is listed type.
then type
put in password if required.
then type to save the RULE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOW Installation:
we are going to install screen.
type:
name@localhost:~/
type in or copy/paste this in your command prompt name@localhost:~/
than you need to rename linux64 to factorio.tar.xz
example: or
then the extraction:
or
make sure that your factorio files are owned by factorio if not for some reason it is setup as root owner you need to type this as root or sudo
Example:
so when you log into factorio it will not give you permission denied because it is owned by root.
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
After you have created your save file we going to start working on your server-settings.json
head over to /home/factorio/data/ and some coping file to file. here is an example
after you have completed that you can now nano or vim server-settings.json and adjust your settings in there.
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
this will start your server, the only thing is that you will have to keep your shell connection to the server open all the time, So what i did was quicker and simple way to do it.
type nano/vim start.sh
then type at the first line or
they type at the next line
save it.
then type
then type
after it completes loading up (15 secs) then hit your ctrl a-d will close the screen out, (to check if it worked type screen -R) it will return you back to server loading stage. when you want to return to it at a later time simply go into your shell using your login factorio and type screen -R then when you need to shut it down just hit ctrl-c.
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
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