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

Guides about mapping and everything Teeworlds related.

User avatar
Ryozuki
User
Posts: 1736
Joined: Tue Feb 24, 2015 7:28 am
Location: Catalonia
Player profile: Ryozuki
Mapper profile: Ryozuki
Clan: Unique
Website: https://ryozuki.xyz/

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

Post by Ryozuki » Sun Nov 15, 2015 6:11 pm

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 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
Retired Administrator
Posts: 3256
Joined: Mon May 05, 2014 2:30 pm
Player profile: deen

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

Post by deen » Mon Jan 04, 2016 1:05 am

In the last line that should be DDNet-Server_sql I believe.

User avatar
Amulus
User
Posts: 40
Joined: Sat Dec 13, 2014 4:31 pm
Player profile: Amu~Cookie
Clan: BioPi
Contact:

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

Post by Amulus » Mon Jan 04, 2016 3:18 pm

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
Retired Administrator
Posts: 3256
Joined: Mon May 05, 2014 2:30 pm
Player profile: deen

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

Post by deen » Mon Jan 04, 2016 3:59 pm

That's not an error. It just checks whether this config file exists, if it doesn't then that's fine.

User avatar
Ryozuki
User
Posts: 1736
Joined: Tue Feb 24, 2015 7:28 am
Location: Catalonia
Player profile: Ryozuki
Mapper profile: Ryozuki
Clan: Unique
Website: https://ryozuki.xyz/

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

Post by Ryozuki » Sun Jun 12, 2016 5:21 pm

I reworked the tutorial a bit and soon i'll add a video.

User avatar
Ryozuki
User
Posts: 1736
Joined: Tue Feb 24, 2015 7:28 am
Location: Catalonia
Player profile: Ryozuki
Mapper profile: Ryozuki
Clan: Unique
Website: https://ryozuki.xyz/

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

Post by Ryozuki » Wed Jun 15, 2016 7:25 am

Added video.

Chairn
User
Posts: 384
Joined: Sat Apr 11, 2015 5:05 pm
Player profile: Chairn
Clan: QuintessenZ

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

Post by Chairn » Wed Jun 15, 2016 9:26 am

Please add date on your first post so that people know that it is up to date.

User avatar
Ryozuki
User
Posts: 1736
Joined: Tue Feb 24, 2015 7:28 am
Location: Catalonia
Player profile: Ryozuki
Mapper profile: Ryozuki
Clan: Unique
Website: https://ryozuki.xyz/

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

Post by Ryozuki » Wed Jun 15, 2016 11:22 am

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
User
Posts: 384
Joined: Sat Apr 11, 2015 5:05 pm
Player profile: Chairn
Clan: QuintessenZ

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

Post by Chairn » Wed Jun 15, 2016 12:32 pm

Just add:
Last edited on 14/06/16.

User avatar
stompie
User
Posts: 699
Joined: Thu Jun 18, 2015 2:40 pm
Player profile: stompie
Mapper profile: stompie

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

Post by stompie » Wed Jun 15, 2016 5:47 pm

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

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest