[Guide] L2J Server on Linux 2017

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Locked
amadejs
Posts: 2
Joined: Thu Nov 30, 2017 9:27 pm

[Guide] L2J Server on Linux 2017

Post 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
Last edited by amadejs on Sun Dec 10, 2017 8:02 pm, edited 1 time in total.
User avatar
KGB1st
Posts: 230
Joined: Sat Jul 26, 2014 5:58 pm

Re: [Guide] L2J Server on Linux 2017

Post 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:
amadejs
Posts: 2
Joined: Thu Nov 30, 2017 9:27 pm

Re: [Guide] L2J Server on Linux 2017

Post 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:
Sacrifice
Advanced User
Advanced User
Posts: 1026
Joined: Thu Aug 14, 2014 6:31 am

Re: [Guide] L2J Server on Linux 2017

Post by Sacrifice »

Luven
Posts: 2
Joined: Tue Oct 16, 2018 8:52 pm

Re: [Guide] L2J Server on Linux 2017

Post 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:
User avatar
regenx
Posts: 319
Joined: Sat Jul 17, 2010 6:55 am

Re: [Guide] L2J Server on Linux 2017

Post 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:
Luven
Posts: 2
Joined: Tue Oct 16, 2018 8:52 pm

Re: [Guide] L2J Server on Linux 2017

Post 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?
Sacrifice
Advanced User
Advanced User
Posts: 1026
Joined: Thu Aug 14, 2014 6:31 am

Re: [Guide] L2J Server on Linux 2017

Post by Sacrifice »

L2j will fix for you...
heavenro
Posts: 1
Joined: Wed Apr 04, 2018 8:00 am

Re: [Guide] L2J Server on Linux 2017

Post by heavenro »

Hi. I have the same problem as Luven in his last post. Stuck at point 9. could anyone help please? Thanx
User avatar
regenx
Posts: 319
Joined: Sat Jul 17, 2010 6:55 am

Re: [Guide] L2J Server on Linux 2017

Post 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.
User avatar
Zoey76
L2j Inner Circle
L2j Inner Circle
Posts: 7005
Joined: Tue Aug 11, 2009 3:36 am

Re: [Guide] L2J Server on Linux 2017

Post by Zoey76 »

For Debian and possible Ubuntu follow this guide: http://www.l2jserver.com/debian.html
Powered by Eclipse 4.30 ๐ŸŒŒ | Eclipse Temurin 21 โ˜• | MariaDB 11.2.2 ๐Ÿ—ƒ๏ธ | L2J Server 2.6.3.0 - High Five ๐Ÿš€

๐Ÿ”— Join our Discord! ๐ŸŽฎ๐Ÿ’ฌ
Locked