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:
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
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
CTF Rotation 24/7 - 81.4.101.88:8304
DM Rotation 24/7 - 81.4.101.88:8305 Rotation-Server Forum Thread