Page 1 of 1

[Guide] L2J Server on Linux 2017

Posted: Sat Dec 09, 2017 12:02 am
by amadejs
How to run L2j Hi5 server on Linux Debian/Ubuntu server operating systems.


################## Disclaimer ###########################
This guide IS NOT security based and it is for testing
only. Use at your own risk! Also this guide will not
describe how to install and configure game client.
#########################################################



Tested on Ubuntu/Debian server operating systems (01.12.2017).

From my personal experienceon VirtualBox minimal server requirements for few palyers:
1 VCPU
3G RAM
20 GB HDD


1) Install server operating system. I recommend keep as minimal as possible, install minimal server software + openssh-server.

2) Connect to your server via SSH client putty or other and preapre software:

Code: Select all

$ apt-get install git-core openjdk-8-jdk vim htop dstat unzip
3) Create some folders:

Code: Select all

$ mkdir ~/development
$ mkdir ~/server
$ cd ~/development/
4) Get sources code for L2j server and L2j datapack

Code: Select all

 $ git clone https://bitbucket.org/l2jserver/l2j_server.git
$ git clone https://bitbucket.org/l2jserver/l2j_datapack.git
5) Compile files for L2j datapack and L2j Server:

Code: Select all

$ cd ~/development/l2j_datapack
$ ./gradlew

Code: Select all

$ cd ~/development/l2j_server/
$ ./gradlew
6) Move compiled archives to server folder and unzip them:

Code: Select all

$ mv ~/development/l2j_datapack/build/distributions/L2J_DataPack_2017-12-08.zip ~/server/
$ mv ~/development/l2j_server/build/distributions/L2J_Server_2017-12-08.zip ~/server/
$ cd ~/server/
$ unzip L2J_Server_2017-12-08.zip
$ unzip L2J_DataPack_2017-12-08.zip
$ mkdir ~/server/game/log
$ mkdir ~/server/login/log
$ chmod 750 ~/server/login/*.sh
$ chmod 750 ~/server/game/*.sh
7) Lets install database server software (please dont leave empty password for mysql root user):

Code: Select all

$ sudo apt-get install mysql-server
7.1) Check that mysql-server is up and running:

Code: Select all

  $ service mysql status
  $ netstat -anp | grep :3306
8 ) Lets configure some databases for L2j game server and login server and users:

Code: Select all

$ mysql -u root -p
### Commands are executed in mysql console:

Code: Select all

mysql> create database l2jgs;
mysql> create database l2jls;
mysql> grant insert, select, update, delete, alter, create, trigger, drop, index on l2jls.* to 'l2lsuser'@'localhost' identified by 'D0ntUs3SamePassw0rds';
mysql> grant insert, select, update, delete, alter, create, trigger, drop, index on l2jgs.* to 'l2gsuser'@'localhost' identified by 'MySup3rComplexPassw0rd';

9) Lets execute sql scripts to create tables and structure:

Code: Select all

$ cd ~/server/sql/login/
$ for i in `ls | grep .sql`; do sudo mysql --defaults-file=/etc/mysql/debian.cnf l2jls < $i; done

Code: Select all

$ cd ~/server/sql/game/
$ for i in `ls | grep .sql`; do sudo mysql --defaults-file=/etc/mysql/debian.cnf l2jgs < $i; done
10) Edit config files and provide database user and password. !!! These passwords and usernames are only for example !!!

Code: Select all

$ nano ~/server/login/config/LoginServer.properties
Login = l2lsuser
Password = D0ntUs3SamePassw0rds

Code: Select all

$ nano  ~/server/game/config/Server.properties
Login = l2gsuser
Password = MySup3rComplexPassw0rd
11) Start Login server

Code: Select all

$ cd ~/server/login/; ./startLoginServer.sh
##To ensure your login server is starting corectly you can check log file:

Code: Select all

$ tail ~/server/login/log/stdout.log
## and if u see these lines login server is up.
[09/12 00:37:41] Listening for GameServers on 127.0.0.1:9014
[09/12 00:37:41] Telnet server is currently disabled.
[09/12 00:37:41] L2LoginServer: is now listening on: *:2106
## Also you can check if port is listening:

Code: Select all

$ netstat -ntlp | grep :2106
12) start Game server

Code: Select all

$ cd ~/server/game/; ./startGameServer.sh
##To ensure your login server is starting corectly you can check log file:

Code: Select all

$ tail ~/server/game/log/stdout.log 
## and if u see these lines game server is up.
[09/12 01:11:22] Connecting to login on 127.0.0.1:9014
[09/12 01:11:22] Registered on login as Server 1: Bartz
[09/12 01:11:22] GameServer: is now listening on: *:7777
## Also you can check if port is listening:

Code: Select all

$ netstat -ntlp | grep :7777

Re: [Guide] L2J Server on Linux 2017

Posted: Sat Dec 09, 2017 4:05 am
by KGB1st
looks like good stuff, but linux users nedeed a bash script.. :clap: :crazy: :problem: :problem: :problem:
last my modification on my testing server supports a batch script for updating the server from git repo, whith recompilation and installation :really:

Re: [Guide] L2J Server on Linux 2017

Posted: Sat Dec 09, 2017 8:05 am
by amadejs
I agree that bash/python script for automation is useful. But my goal was to show how to put all puzzle pieces together.
8) It is better to know what is under the hood at first, after that you can make your automation script for your own taste. But will see, maybe i will post some script for automation.

:wave:

Re: [Guide] L2J Server on Linux 2017

Posted: Sat Dec 09, 2017 6:00 pm
by Sacrifice

Re: [Guide] L2J Server on Linux 2017

Posted: Tue Oct 16, 2018 9:07 pm
by Luven
5) Compile files for L2j datapack and L2j Server:

Code: Select all

$ cd ~/development/l2j_datapack
$ ./gradlew
Ok. Build successful.

Code: Select all

$ cd ~/development/l2j_server/
$ ./gradlew


Build Failed. Here's the output.

Code: Select all

Build in build/distributions/L2J_Server_2018-10-16.zip

> Task :compileJava FAILED

FAILURE: Build failed with an exception.


* What went wrong:
Execution failed for task ':compileJava'.
> Could not target platform: 'Java SE 10' using tool chain: 'JDK 8 (1.8)'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
Btw I'm running Linux Centos 7, building the datapack is OK, building the server... FAIL.

Can anyone help at this? Please?? :think:

Re: [Guide] L2J Server on Linux 2017

Posted: Sat Oct 27, 2018 3:48 am
by regenx
building the server... FAIL. - related to Eclipse (check if you have same JRE version or JDK) and not to Linux.


@adamejs
You forgot to use nohup (for remote connections).
:wave:

Re: [Guide] L2J Server on Linux 2017

Posted: Tue Oct 30, 2018 3:50 pm
by Luven
Luven wrote: Tue Oct 16, 2018 9:07 pm
5) Compile files for L2j datapack and L2j Server:

Code: Select all

$ cd ~/development/l2j_datapack
$ ./gradlew
Ok. Build successful.

Code: Select all

$ cd ~/development/l2j_server/
$ ./gradlew


Build Failed. Here's the output.

Code: Select all

Build in build/distributions/L2J_Server_2018-10-16.zip

> Task :compileJava FAILED

FAILURE: Build failed with an exception.


* What went wrong:
Execution failed for task ':compileJava'.
> Could not target platform: 'Java SE 10' using tool chain: 'JDK 8 (1.8)'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
Btw I'm running Linux Centos 7, building the datapack is OK, building the server... FAIL.

Can anyone help at this? Please?? :think:
Solved. I just installed another version of Java (1.10+ to compile the server, while the datapack works with 1.8 ). Working with 2 Java environments works fine with me. :+1:
Just to have an idea: https://stackoverflow.com/questions/439 ... 7-1-7?rq=1


But now I'm stuck at point 9. Output is:

Code: Select all

[xxx@new-host login]# for i in `ls | grep .sql`; do sudo mysql --defaults-file=/etc/mysql/debian.cnf l2jls < $i; done

Could not open required defaults file: /etc/mysql/debian.cnf
Fatal error in defaults handling. Program aborted
But Mysql server IS installed and active, previous steps are ok.
Google seems not to be helping..

Anyone?

Re: [Guide] L2J Server on Linux 2017

Posted: Fri Nov 02, 2018 1:38 pm
by Sacrifice
L2j will fix for you...

Re: [Guide] L2J Server on Linux 2017

Posted: Tue Jan 15, 2019 5:57 pm
by heavenro
Hi. I have the same problem as Luven in his last post. Stuck at point 9. could anyone help please? Thanx

Re: [Guide] L2J Server on Linux 2017

Posted: Wed Jan 16, 2019 2:42 am
by regenx
Hi, :)
You don't need to run those commands in Terminal, just connect to your MySQL server using any SQL manager (I recommend HeidiSQL via WINE) and create your database tables for Loginserver and Gameserver and upload them from your L2Jserver SQL folder.

Re: [Guide] L2J Server on Linux 2017

Posted: Sun Aug 25, 2019 7:56 pm
by Zoey76
For Debian and possible Ubuntu follow this guide: http://www.l2jserver.com/debian.html