Page 1 of 4

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

Posted: Sun Nov 15, 2015 6:11 pm
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

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

Posted: Mon Jan 04, 2016 1:05 am
by deen
In the last line that should be DDNet-Server_sql I believe.

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

Posted: Mon Jan 04, 2016 3:18 pm
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

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

Posted: Mon Jan 04, 2016 3:59 pm
by deen
That's not an error. It just checks whether this config file exists, if it doesn't then that's fine.

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

Posted: Sun Jun 12, 2016 5:21 pm
by Ryozuki
I reworked the tutorial a bit and soon i'll add a video.

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

Posted: Wed Jun 15, 2016 7:25 am
by Ryozuki
Added video.

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

Posted: Wed Jun 15, 2016 9:26 am
by Chairn
Please add date on your first post so that people know that it is up to date.

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

Posted: Wed Jun 15, 2016 11:22 am
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

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

Posted: Wed Jun 15, 2016 12:32 pm
by Chairn
Just add:
Last edited on 14/06/16.

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

Posted: Wed Jun 15, 2016 5:47 pm
by stompie
Linux >.<