Skip to main content

Installation Guide

Introduction

About Us

L2J Server is the official open-source project developed in Java that attempts to provide a game server for Lineage II.

We have been around for a long time, and our mission is to provide the closest experience to the official game.

Our vision is to have a server that can run any version of the game based on configurations and using a microservice cloud-ready architecture.

About the Product

L2J Server divides in two components, L2j Game Server and L2j Login Server, at the same time L2j Game Server is divided in Core and Datapack, the Core is the Java code that defines the game mechanics, persistence and communication mechanics, and the Datapack is composed by all the files that are related to the game play such as dialogs, quest scripts, AIs, etc.

Installing the server requires to install additional software first (Java, database, Git, etc.), then get the source code, compile the source code, install the database, deploy the compiled server files, minimum configurations and start the server and test.

Required Software

  • Updated OS
  • Java
  • MariaDB (or MySQL)
  • Git

Update the OS

wuauclt /detectnow /updatenow

Get & Install Java

L2J is built using Java, to build the server you need Java JDK as well.

winget install EclipseAdoptium.Temurin.21.JDK

If you have already used winget, you can upgrade your Java version using:

winget upgrade EclipseAdoptium.Temurin.21.JDK

Check the Java version

java --version
tip

We recommend updating the JAVA_HOME environment variable.

info

As long as it's possible, L2J will be compatible with the latest LTS (Long-Term-Support) version of Java, you can check the roadmap for Java SE here.

Get & Install Git

L2J uses Git as version control system on BitBucket, use it to get the latest versions.

winget install -e --id Git.Git

Check the Git version:

git --version
info

We recommend getting the source code directly from our public repositories.

Get & Install the Database Server

Download and install a database server and create a specific user.

winget install -e --id MariaDB.Server

Execute the following SQL statements to create a L2J specific database user:

mariadb -u root -p
create_user.sql
CREATE OR REPLACE USER 'l2j'@'%' IDENTIFIED BY 'l2jserver2019';
GRANT ALL PRIVILEGES ON *.* TO 'l2j'@'%' IDENTIFIED BY 'l2jserver2019';
FLUSH PRIVILEGES;
exit
warning

We recommend changing the default database password. If you do it, you need to edit server.properties files inside the game server config folder and the login server config folder.

tip

We recommend (optionally) downloading and installing HeidiSQL or DBeaver to manage the database.

info

L2J is compatible with MySQL 8.0+, but we recommend MariaDB.

Install Unzip

Not required for Windows.

Get the Source Code

Our official repositories are the ones listed below.

mkdir C:\opt\l2j\git
cd C:\opt\l2j\git
git clone -b master https://bitbucket.org/l2jserver/l2j-server-login.git
Cloning into 'l2j-server-login'...
remote: Counting objects: 353, done.
remote: Compressing objects: 100% (285/285), done.
remote: Total 353 (delta 194), reused 63 (delta 26)
Receiving objects: 100% (353/353), 110.40 KiB | 324.00 KiB/s, done.
Resolving deltas: 100% (194/194), done.

git clone -b develop https://bitbucket.org/l2jserver/l2j-server-game.git
Cloning into 'l2j-server-game'...
remote: Counting objects: 162315, done.
remote: Compressing objects: 100% (26695/26695), done.
remote: Total 162315 (delta 122790), reused 157270 (delta 117810)
Receiving objects: 100% (162315/162315), 125.97 MiB | 9.93 MiB/s, done.
Resolving deltas: 100% (122790/122790), done.

git clone -b develop https://bitbucket.org/l2jserver/l2j-server-datapack.git
Cloning into 'l2j-server-datapack'...
remote: Counting objects: 278648, done.
remote: Compressing objects: 100% (66228/66228), done.
remote: Total 278648 (delta 215765), reused 269687 (delta 207236)
Receiving objects: 100% (278648/278648), 144.49 MiB | 9.63 MiB/s, done.
Resolving deltas: 100% (215765/215765), done.
Checking out files: 100% (24264/24264), done.
info

develop branch contains the latest version of High Five, master branch contains the stable version of High Five. Other options are Interlude, Epilogue, Freya, etc.

Build the Server

We use Maven to build the server files, and execute the following commands:

cd C:\opt\l2j\git\l2j-server-login
mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.l2jserver:l2j-server-login >-------------------
[INFO] Building L2J Login Server 2.6.1.6
...

cd C:\opt\l2j\git\l2j-server-game
mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.l2jserver:l2j-server-game >--------------------
[INFO] Building L2J Game Server 2.6.2.0-SNAPSHOT
...

cd C:\opt\l2j\git\l2j-server-datapack
mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.l2jserver:l2j-server-datapack >------------------
[INFO] Building L2J DataPack 2.6.2.0-SNAPSHOT
...

To avoid the following warning

warning

[WARNING] An NVD API Key was not provided - it is highly recommended to use an NVD API key as the update can take a VERY long time without an API Key

You need to get an API Key from NIST and set an environment variable NVD_API_KEY with the given key.

The API Key, if present, will be used to get the vulnerability database files.

Deploy the Server

The deployment process at the moment is simply unzipping the built files.

Deploy the Login Server

mkdir C:\opt\l2j\server\login
cd C:\opt\l2j\server\login
tar -xf C:\opt\l2j\git\l2j-server-login\target\l2j-server-login-2.6.5.2.zip

Deploy the Game Server

mkdir C:\opt\l2j\server\game
cd C:\opt\l2j\server\game
tar -xf C:\opt\l2j\git\l2j-server-game\target\l2j-server-game-2.6.3.0-SNAPSHOT.zip
tar -xf C:\opt\l2j\git\l2j-server-datapack\target\l2j-server-datapack-2.6.3.0-SNAPSHOT.zip
warning

The file names may change with each new version, take that into consideration.

Install the Database

Get L2J CLI

L2J CLI is a tool that allows us to implement automated deployments and initial configurations.

mkdir C:\opt\l2j\cli
cd C:\opt\l2j\cli
curl -o l2jcli.zip -L https://l2jserver.com/api/download/cli/latest
tar -xf l2jcli.zip

Configure the CLI

Inside the folder config edit both files login-server.properties and game-server.properties and configure DatabaseUser and DatabasePassword accordingly to the user and password that has been configured for the database.

Execute the CLI

Run l2jcli.bat and run the following commands:

l2jcli.bat
db install -sql C:\opt\l2j\server\login\sql -u l2j -p l2jserver2019 -m FULL -t LOGIN -c -mods
db install -sql C:\opt\l2j\server\game\sql -u l2j -p l2jserver2019 -m FULL -t GAME -c -mods

The parameters are:

ParameterDescription
-sql pathPath to SQL files
-u userDatabase user
-p passwordDatabase password
-m modeInstallation mode FULL or UPDATE
-t typeServer type LOGIN or GAME
-cInstall custom tables
-modsInstall mods tables

Create Administrator Account

Use the L2J CLI to create an administrator account, 8 is the maximum account level (master):

account create -u Zoey76 -p -a 8
quit

Open Server Ports

If you are not playing from localhost, you may need to open some ports on your server.

netsh advfirewall firewall add rule name="L2J Login Server" dir=in action=allow protocol=TCP localport=2106
netsh advfirewall firewall add rule name="L2J Game Server" dir=in action=allow protocol=TCP localport=7777
warning

This action requires an elevated command prompt. Please run the command prompt as an administrator.

warning

Only these ports are required to connect to the server as a player.

Geodata

L2J Server uses geodata files to include the environment information into the server.

You can download the latest version from here.

Start the Servers

Initial Configuration

These commands create the required folders for logs and grant access permissions to the scripts.

Not required for Windows.

Start the Servers

To start the servers, you need to run two scripts, one for the game server and another for the login server.

C:\opt\l2j\server\login\startLoginServer.bat
C:\opt\l2j\server\game\startGameServer.bat

Connect to the Server

To connect to the server, you have the following options:

HOSTS file

Edit C:\Windows\System32\drivers\etc\hosts and add this line:

127.0.0.1 l2authd.lineage2.com

BAT file

Create a .bat file with the following content:

@start l2.bin IP=127.0.0.1

Custom exe

Here is a C++ Win32 exe example:

#define _WIN32_WINNT _WIN32_WINNT_WINXP
#define NOMINMAX
#include <windows.h>
#include <cstdlib>

// Start L2 as .bin with IP as parameter.
// You can use IP or DNS as IP parameter.
// You could include other parameters.
// You can change the path to the .bin file to avoid including the L2.exe inside the System folder.
// Author: Zoey76
int _stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) {
ShellExecute(0, L"open", L"cmd.exe", L"/C start l2.bin IP=127.0.0.1", 0, SW_HIDE);
}
info

Download compiled version from here, more information here.

danger

Client modifications are not allowed in L2J, this includes GameGuard and L2.ini changes.