How to compile server and set it up with MySQL (Mariadb) on Linux

Read tips and guides about teeworlds-related subjects (mapping, compiling, ..).
User avatar
Ryozuki
Posts: 1748
Joined: Tue Feb 24, 2015 7:28 am
Location: Catalonia
Player profile: http://ddnet.tw/players/Ryozuki/
Mapper profile: http://ddnet.tw/mappers/Ryozuki/
Clan: Unique
Website: https://edgarluque.com
Discord: Ryozuki#2188

How to compile server and set it up with MySQL (Mariadb) on Linux

Post by Ryozuki »

How to compile server and set it up with MySQL on Linux
written by Ryozuki, slightly edited by Index

VIDEO
Video not updated to current version
SpoilerShow
COMPILE SERVER
Install packgages with this command:

sudo apt-get install bam libsdl2-dev libfreetype6-dev libcurl4-openssl-dev libogg-dev libopus-dev libopusfile-dev

apt-get install unzip
wget https://github.com/ddnet/ddnet/archive/master.zip
unzip master.zip
cd ddnet-master

ESTABLISH A SERVER WITH MYSQL (Mariadb)
FIrst of all you have to install mySQL and run it. I recommend to press y(es) to all.

Note: In this tutorial we use mariadb, a open-source driven version of mysql with more features and better perfomence. (It's fully compatible with mysql)

sudo apt-get install libmariadbclient-dev libmysqlcppconn-dev libboost-dev mariadb-server
Run mysql_secure_installation and follow the steps, note: it's recommended to set a root password.

On your server config enable mysql and make it load the config:
nano autoexec_server.cfg
sv_use_sql 1
add_sqlserver r database_name "prefix" "user" "password" "localhost" "3306" 1
add_sqlserver w database_name "prefix" "user" "password" "localhost" "3306" 1


What this does?
You need the 2 entries, notice the "w" and the "r", one reads and the other writes to the database.

The prefix is a name prepended to the generated tables (recommended to use "record", it will the generate tables called record_race, record_teamrace, record_points, etc)
  • "database_name" is the name of the database, i usually use "teeworlds" or "ddnet"
  • The number 3306 is the default mariadb and mysql port.
  • The number 1 at the end means "enabled"
  • "localhost" is the ip, only change if you have strong reasons, or want to connect to a db on another sv.
Run bam config mysql.use_mysqlconfig=true

Compile the server:
bam server_sql_release

Install screen, so you can run the server after you close the shell.

sudo apt-get install screen
screen ./DDNet-Server_sql -f autoexec_server.cfg

Then you detach it with control+a then control+d
Last update: 16-05-2017
User avatar
deen
TECHNICAL Team
Posts: 3575
Joined: Mon May 05, 2014 2:30 pm
Player profile: https://ddnet.org/players/deen/
Discord: deen#5910

Re: How to compile client and set-up server on Linux

Post by deen »

In the last line that should be DDNet-Server_sql I believe.
User avatar
Amulus
Posts: 40
Joined: Sat Dec 13, 2014 4:31 pm
Player profile: http://ddnet.tw/players/Amu~Cookie/
Clan: BioPi
YouTube: user/MrAmulus

Re: How to compile client and set-up server on Linux

Post by Amulus »

Thank you for the tuto :).
I got an error tho : [16-01-04 14:16:54][console]: failed to open 'maps/Kobra 4.map.cfg'
But the server seem working i'm connected to it
Take this COOKIE
User avatar
deen
TECHNICAL Team
Posts: 3575
Joined: Mon May 05, 2014 2:30 pm
Player profile: https://ddnet.org/players/deen/
Discord: deen#5910

Re: How to compile client and set-up server on Linux

Post by deen »

That's not an error. It just checks whether this config file exists, if it doesn't then that's fine.
User avatar
Ryozuki
Posts: 1748
Joined: Tue Feb 24, 2015 7:28 am
Location: Catalonia
Player profile: http://ddnet.tw/players/Ryozuki/
Mapper profile: http://ddnet.tw/mappers/Ryozuki/
Clan: Unique
Website: https://edgarluque.com
Discord: Ryozuki#2188

Re: How to compile server and set it up with mySQL on Linux

Post by Ryozuki »

I reworked the tutorial a bit and soon i'll add a video.
User avatar
Ryozuki
Posts: 1748
Joined: Tue Feb 24, 2015 7:28 am
Location: Catalonia
Player profile: http://ddnet.tw/players/Ryozuki/
Mapper profile: http://ddnet.tw/mappers/Ryozuki/
Clan: Unique
Website: https://edgarluque.com
Discord: Ryozuki#2188

Re: How to compile server and set it up with mySQL on Linux

Post by Ryozuki »

Added video.
Chairn
Posts: 400
Joined: Sat Apr 11, 2015 5:05 pm
Player profile: http://ddnet.tw/players/Chairn/
Clan: QuintessenZ

Re: How to compile server and set it up with MySQL on Linux

Post by Chairn »

Please add date on your first post so that people know that it is up to date.
User avatar
Ryozuki
Posts: 1748
Joined: Tue Feb 24, 2015 7:28 am
Location: Catalonia
Player profile: http://ddnet.tw/players/Ryozuki/
Mapper profile: http://ddnet.tw/mappers/Ryozuki/
Clan: Unique
Website: https://edgarluque.com
Discord: Ryozuki#2188

Re: How to compile server and set it up with MySQL on Linux

Post by Ryozuki »

Chairn wrote:Please add date on your first post so that people know that it is up to date.
What you mean? If you mean the source, on the tutorial post is allways up to date cuz u download master branch. On the vid i downloaded the 10.1 because idk xD
Chairn
Posts: 400
Joined: Sat Apr 11, 2015 5:05 pm
Player profile: http://ddnet.tw/players/Chairn/
Clan: QuintessenZ

Re: How to compile server and set it up with MySQL on Linux

Post by Chairn »

Just add:
Last edited on 14/06/16.
User avatar
stompie
Posts: 700
Joined: Thu Jun 18, 2015 2:40 pm
Player profile: http://ddnet.tw/players/stompie/
Mapper profile: https://ddnet.tw/mappers/stompie/

Re: How to compile server and set it up with MySQL on Linux

Post by stompie »

Linux >.<
\,,/(◣_◢)\,,/
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests