1 (edited by MaikBey 2016-02-29 01:01:47)

Topic: [Tutorial] Create your own Server on a VPS (Remote Server)

Creating a Server on your own machine is very easy, since all you need to do is executing the teeworlds_srv in your Teeworlds folder. However, creating your own full fledged Server on a dedicated machine is almost as easy and very cheap. I have done it successfully with my 3 Servers.

If you know what you are doing and/or already got a VPS, jump to "Installing and configuring the Teeworlds Server" below.

Returning readers may review commands at the "Important Commands" section near the bottom.

Choosing a Host for your own Virtual Server

While there are some "game server" kind of hosts, such as nitrado, they do charge you per slot and a 16 slot teeworlds server can cost you around 20€ per month. For 20€ and a few minutes of your time you can get up to 10 Teeworld Servers for 1 full year.

There is a site, which regularly posts about great offers of cheap and low end VPS. It is called https://lowendbox.com and highly recommended. Select your region, browse through the listings and look for recent entries, then just pick a few of the cheapest ones and check their comments to get the full picture and make your decision.

I will not guide you through the registering process, since most hosts are user friendly in that respect. You do not have to worry about the specs at all, make sure you have at least 50GB traffic per month. My Servers run on one 128MB RAM, 80GB HDD space and 1 low end CPU core. Teeworlds is 8 Years old and can even run on a Rasberry Pi.

Setting up your System

While ordering your VPS you are usually asked to choose an operating system. Go with Debian Minimal 64Bit if you can (please choose 64Bit even if you only got 128 MB RAM or it will be a hassle later on), however the regular Debian version works as well and so does pretty much any other linux distribution. You can reinstall the OS and switch with a few clicks later on as well. If it wants you to enter a hostname during placing the order, just type whatever you want.

Now you should have gotten some confirmation mails with access to your server, the client area of the host and/or access to a "Control Panel" which lets you reinstall the OS, Reboot and some other stuff.

In order to gain access to your server download PuTTY ( take the first thing here: http://www.chiark.greenend.org.uk/~sgta … nload.html ) or do it via Linux ( via inbuilt ssh or sudo apt-get install putty )

Open PuTTY and insert the IP of your VPS (Found in your confirmation E-Mail or the Control Panel or the Client Area of your host) and enter a Port (usually 22, format is 127.0.0.1:22 with 127.0.0.1 being the IP and 22 the Port). Press Open at the bottom of the window and a console window will open.

It will now ask for your login (which is listed in your confirmation Mail at SSH Information or so, usually root) and the password afterwards. Type in one after the other and confirm. You do now have access to your VPS and can setup your own dedicated Server.

Installing and configuring the Teeworlds Server

When you log into your VPS you will be greeted with something like that:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@hostname:~# 

First install these 2 programs to your Server by executing these 2 commands:

apt-get install nano

(A text editor)

apt-get install screen

(makes running the Server easier)

Now follow these steps to install Teeworlds and its server. Please note that when 0.6.4 and future versions release you do need to adjust the following link by changing the Version bellow:

wget --no-check-certificate https://downloads.teeworlds.com/teeworlds-0.6.3-linux_x86_64.tar.gz

(the --no-check-certificate can be unsafe, the more time consuming "safe" method however is something only autistic arch linux user do and you just want to install some Server so who even cares.)

Use this to unzip what you have downloaded:

tar xfv teeworlds-0.6.3-linux_x86_64.tar.gz

Now create a directory for your files:

mv teeworlds-0.6.3-linux_x86_64 tw

(of course you can name it something else, just change the "tw" part

Move into your new directory by using cd (protip: the command ls lists all files and sub-directories)

cd tw

Your commandline will now look like this:

root@hostname:~/tw#

Grant rights so you can execute the Server later on

chmod +x teeworlds_srv

While you can start your server without config using ./teeworlds_srv it will show up as some unnamed pos server, therefore it is now time to use the text-editor nano (downloaded earlier) to create and edit a config file. Type

nano config.cfg

You will now have some empty black window of nothing. Don't worry, just follow the next step:

  GNU nano 2.2.6                File: config.cfg
















                                  [ New File ]
^G Get Help  ^O WriteOut  ^R Read File ^Y Prev Page ^K Cut Text  ^C Cur Pos
^X Exit      ^J Justify   ^W Where Is  ^V Next Page ^U UnCut Text^T To Spell

These Resources will help you a lot by creating your own config:

You can copy and paste everything by copying it normally and then rightclicking your PuTTY console window to paste it. Make sure you have 1 option per line. Here the sample from the link above in nano:

  GNU nano 2.2.6                File: config.cfg                              Modified

sv_name Teeworlds sample dm
sv_map dm1
sv_scorelimit 20
sv_timelimit 10
sv_gametype dm
sv_rcon_password remember (change this or you have trouble)
sv_motd Teeworlds sample dm configuration
sv_max_clients 12
sv_spectator_slots 10







^G Get Help  ^O WriteOut  ^R Read File ^Y Prev Page ^K Cut Text  ^C Cur Pos
^X Exit      ^J Justify   ^W Where Is  ^V Next Page ^U UnCut Text^T To Spell

You can ignore everything else, if you want to save your config just execute CTRL+X. That will close the textwindow, but before that it will ask you to save the file. press Y when it does and it is saved. In case you messed up just do CTRL+X and press N for no if it asks you to save.

You are now back at the console. Test your server by using the following command and open your game via Steam or so and search for your server. You can also manually enter the IP of your VPS and add a :8303 (default port of the Teeworlds server) to join it. Come back to this Guide after you tested it and went like "dud that was ez"

./teeworlds_srv -f config.cfg

in order to stop the server you need to execute CTRL+C, after that you can type commands again. In order to have your server running all day long, you will need to use the program "screen". Screen also allows you to run multiple servers at once. Type:

screen -dm ./teeworlds_srv -f config.cfg

Your server is now running

Advanced Setup

0. Make sure you are in the previously added Directory tw (or however you named it) with all the necessary files. When you log into your VPS type

cd tw

to make sure you are


1. Getting out of the screen session without terminating the server

While you can just close PuTTY, open it again and just login again to use commands and perhaps editing the config file for a future restart, you can also just execute CTRL+A and then CTRL+D in a Screen session to return to your command-line.

2. Entering a session, that runs in the background

First you need to identify which Screen sessions are running, type

screen -r

to see them.

You will now see something like that:

root@hostname:~# screen -r
There are several suitable screens on:
        42069.pts-0.hostname  (04/20/69 08:08:5)     (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.

Once you have more than one server at once running, you will see more sessions appearing. The pid is the number, so in this case 42069. to select the session shown you need to type

screen -r 42069

You will now see everything your server outputs.

As explained above, use CTRL+A and then CTRL+D to return back to the commandline. CTRL+C will stop the server that is running in your current session.

3. Adding multiple Servers

You may want to add more empty Servers to the masterserver registry. You should be able to run 10 at once with your low end machine. To do that you will need multiple configs.

Add a new config using nano:

nano configname.cfg

It makes sense to call your config similar to the server you want to run, like tdm.cfg for a tdm server

You can also edit an existing config by copying it before you edit it. Copy by using cp:

cp source.cfg newfile.cfg

and of course to open the new file:

nano newfile.cfg

Important step ahead:
You have to add the sv_port setting to your config to have it work properly. Each of your Servers runs on the same ip, the only difference will be the port. In order to have multiple servers working, you must assign each of your servers a distinct port. Choose any port between 1000 and 9999

eg.

sv_port 4390

Once you have all configs setup simpy execute

screen -dm ./teeworlds_srv -f different_config_for_each_server.cfg

for each of your configs and you do now have several Servers up and running.

4. Adding custom maps

Move into your maps directory by executing these commands:

cd tw
cd data
cd maps
wget --no-check-certificate <link to .map file>

to get the direct link to a map file just rightclick the downloadbutton and paste it after the wget --no-check-certificate command.

Afterwards edit your sv_map and/or sv_map_rotation setting in your config file to add it to your server. Maps are case sensitive, only use the map name, not the .map part. e.g. sv_map dm_mymap and not sv_map dm_mymap.map.

Important Commands

A list of important Commands used throughout the Guide.

apt-get install nano

(A text editor)

apt-get install screen

(makes running the Server easier)

wget --no-check-certificate https://downloads.teeworlds.com/teeworlds-0.6.3-linux_x86_64.tar.gz

Download of Teeworld files

tar xfv teeworlds-0.6.3-linux_x86_64.tar.gz

unzipping files

mv teeworlds-0.6.3-linux_x86_64 tw

create Directory

cd teeworlds

move into directory

chmod +x teeworlds_srv

Make server executable

nano config.cfg

Open config file and edit it

./teeworlds_srv -f config.cfg

Test your server

screen -dm ./teeworlds_srv -f config.cfg

Run your server for normal use


screen -r

List of all Screen sessions

screen -r <pid>

Jump into a session

cp source.cfg newfile.cfg

copy files


Important part of every config, when running more than 1 server:

sv_port 4390

Ressources to create your own config file:
Sample configs (use these and edit them as you please): https://www.teeworlds.com/?page=docs&am … er_setup_2
List of all possible server settings: https://www.teeworlds.com/?page=docs&am … r_settings
Tuning (watch out, adding any of these will not make your server show up in the server browser, unless people untick "Strict Gametype" when looking for games): https://www.teeworlds.com/?page=docs&am … ver_tuning

FAQ

Server doesn't show up in the list:

- try

iptables -A INPUT -p tcp --dport 8303 -j ACCEPT

Replace 8303 with ports of your other servers, if necessary.
you may have to uncheck some filters in your serverbrowser to make it appear.

- Feel free to ask if you run into any problems.

- This Guide is available on the Steam Workshop as well: http://steamcommunity.com/sharedfiles/f … =633859135

TDM Rotation 24/7 - 81.4.101.88:8303   List all 3 Servers without typing the IP by searching for rota in-game at the Serverlist
CTF  Rotation 24/7 - 81.4.101.88:8304
DM    Rotation 24/7 - 81.4.101.88:8305     Rotation-Server Forum Thread

2

Re: [Tutorial] Create your own Server on a VPS (Remote Server)

Maybe you have mistaken it a  few times, you don't talk about VPNs (virtual private network), instead VPS (virtual private server)...  Slight notice

Other thing. If you want to run vanilla teeworlds, you can just do

apt install nano screen teeworlds-server

to install all three things in one command (apt is the new apt-get tongue) then execute it like all the other commands.

Having troubles finding servers in the serverlist? Go to Pastebin (its a referer cause there is daily a new pastebin) and add the lines to your settings.cfg (in %APPDATA%\teeworlds). Then open teeworlds and go to the favorites tab. (Note however, standard teeworlds client can only show 256 favorites, use ddnet instead)

3 (edited by MaikBey 2016-02-29 01:03:27)

Re: [Tutorial] Create your own Server on a VPS (Remote Server)

Thanks for the correction, did a search and replace!

apt install does not work on Debian 7 64-bit Minimal, apt-get install did though. I opted out on using apt-get in the tutorial, so people can make their own directory for the teeworlds files. When i tried to use apt-get for the teeworlds files I had the issue of locating them at first. Perhaps there is a way to install it to a predefined directory, because installing it via apt-get would make selecting the right version obsolete. Do you know if that works?

I am a bit unsure about changing up the part where you install nano and screen to one command, kind of easier to follow when it is one after the other.

TDM Rotation 24/7 - 81.4.101.88:8303   List all 3 Servers without typing the IP by searching for rota in-game at the Serverlist
CTF  Rotation 24/7 - 81.4.101.88:8304
DM    Rotation 24/7 - 81.4.101.88:8305     Rotation-Server Forum Thread

4

Re: [Tutorial] Create your own Server on a VPS (Remote Server)

MaikBey wrote:

Go with Debian Minimal 64Bit if you can (please choose 64Bit even if you only got 128 MB RAM or it will be a hassle later on).

I would not recommend a 64 bit install if you do not plan on upgrading in the future.
64 bit OSes take up more (very little) disk space, use more ram memory and are therefore a rather bad choice.
Link 1Link 2
In the first link you'll see the RAM differences between a 64bit and 32bit Ubuntu OS; 388 vs 491 MiB.
The second link is about the disk space, which on Archlinux seems to be 26MiB for the OS, but more for the applications.

privet

5

Re: [Tutorial] Create your own Server on a VPS (Remote Server)

I thought so too at first and installed Debian 32 Bit. However the linux teeworlds files from the download page are only available for a 64 bit system. Since 0.6.3 is the most recent version it would be the one apt-get install teeworlds-server would download as well.

Trying to run that file on a 32 bit system results in an error. Perhaps a libary could make it work, lets face it though; teeworlds is a very low demanding program and you will hardly ever have any trouble. On the other hand if you want to run Teeworlds alongside a powerful VPS, you will be on 64 Bit anyway.

I hope I haven't overseen any 32 bit version of the current serverfiles, if you do know where to get it I would like to change it of course.

TDM Rotation 24/7 - 81.4.101.88:8303   List all 3 Servers without typing the IP by searching for rota in-game at the Serverlist
CTF  Rotation 24/7 - 81.4.101.88:8304
DM    Rotation 24/7 - 81.4.101.88:8305     Rotation-Server Forum Thread

6

Re: [Tutorial] Create your own Server on a VPS (Remote Server)

Well, this article is full of bad advice…

MaikBey wrote:
apt-get install screen

(makes running the Server easier)

That doesn't really make it easier, it just saves you from learning how to set up a service (e.g. systemd units on Debian 8 or Arch Linux). Running a server as a system service provides nice benefits like integration into the system logging (not everywhere, but in the case of systemd), start your Teeworkds server on boot and it can also take care of restarting it in case it crashes.

MaikBey wrote:
wget --no-check-certificate https://downloads.teeworlds.com/teeworlds-0.6.3-linux_x86_64.tar.gz

(the --no-check-certificate can be unsafe, the more time consuming "safe" method however is something only autistic arch linux user do and you just want to install some Server so who even cares.)

Using --no-check-certificate by default is bad practice. Unless you're running an old-as-fuck OS that doesn't ship StartSSL certs, it will work fine without that switch.

MaikBey wrote:

Your commandline will now look like this:

root@hostname:~/tw#

Here's some especially bad advice. Do not ever run software as root unless it's necessary. It definitely isn't for Teeworlds. Better create a user for your server (using e.g. adduser or useradd commands) and install and run the server under that user. (Again: Set up a system service. Those can run processes as specific users.)
Teeworlds (to my knowledge) has not been checked extensively for bugs that could lead to code execution by an attacker. This especially applies to mods. (Also, have you heard about the recent glibc getaddrinfo bug?)


In general it makes sense to know what you're doing. I know that everyone starts out somewhere, but being careless could easily make your server contribute to DDoS attacks (either by being hacked or by running services that can be abused).

7

Re: [Tutorial] Create your own Server on a VPS (Remote Server)

- Thanks for your input. How would you setup the servers as a system service? I found screen to be the easiest, but not most efficient method.

- Debian Minimal and I think the regular Debian 7 didn't come with anything that could handle downloading without bypassing the cert check. However it should work without the flag when downloading the serverfiles at least. Downloading maps, which is mentioned later on does require it or a relatively lengthy safe method.

- I will look into integrating the step of adding a user beforehand, thanks.

I aim for an easy Guide, so people can follow it easier and get started. It is easier to change a running system, than to make a complex one from scratch..

TDM Rotation 24/7 - 81.4.101.88:8303   List all 3 Servers without typing the IP by searching for rota in-game at the Serverlist
CTF  Rotation 24/7 - 81.4.101.88:8304
DM    Rotation 24/7 - 81.4.101.88:8305     Rotation-Server Forum Thread

8

Re: [Tutorial] Create your own Server on a VPS (Remote Server)

System service..... I run my server with daemontools (cr.yp.to/daemontools.html) basically setup of one server Is just the creation of a "run" script and symlinking (then the sevrer runs as user, with log and restarts if crashes and starts on boot). I know a few tricks for installation, if someone is interested.

Having troubles finding servers in the serverlist? Go to Pastebin (its a referer cause there is daily a new pastebin) and add the lines to your settings.cfg (in %APPDATA%\teeworlds). Then open teeworlds and go to the favorites tab. (Note however, standard teeworlds client can only show 256 favorites, use ddnet instead)

9

Re: [Tutorial] Create your own Server on a VPS (Remote Server)

nice tutorial