安装 指南
简介
关于我们
L2J Server 是官方的开源项目,使用 Java 开发,旨在为 Lineage II 提供游戏服务器。
我们已经存在很长时间了,我们的使命是提供最接近官方游戏的体验。
我们的愿景是拥有一个可以根据配置运行任何版本的游戏的服务器,并使用云原生的微服务架构。
关于产品
L2J Server 分为两个组件:L2j Game Server(游戏服务器)和 L2j Login Server(登录服务器)。同时,L2j Game Server 又分为 Core(核心)和 Datapack(数据包)。Core 是定义游戏机制、持久化和通信机制的 Java 代码;Datapack 由所有与游戏玩法相关的文件组成,如对话框、任务脚本、AI 等。
安装服务器需要先安装额外的软件(Java、数据库、Git 等),然后获取源代码、编译源代码、安装数据库、部署编译后的服务器文件,进行最基本的配置,最后启动服务器并测试。
必需软件
- 已更新的操作系统
- Java
- MariaDB (或 MySQL)
- Git
更新操作系统
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
wuauclt /detectnow /updatenow
sudo -i
dnf update
sudo -i
apt update
sudo -i
apt update
brew update && brew upgrade
获取并安装 Java
L2J 使用 Java 构建,要构建服务器,您也需要 Java JDK。
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
winget install EclipseAdoptium.Temurin.25.JDK
如果您已经使用过 winget,可以使用以下命令升级 Java 版本:
winget upgrade EclipseAdoptium.Temurin.25.JDK
检查 Java 版本:
java --version
cat <<EOF > /etc/yum.repos.d/adoptium.repo
[Adoptium]
name=Adoptium
baseurl=https://packages.adoptium.net/artifactory/rpm/${DISTRIBUTION_NAME:-$(. /etc/os-release; echo $ID)}/\$releasever/\$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public
EOF
sudo -i
dnf install -y temurin-25-jdk
检查 Java 版本:
java --version
openjdk 25.0.2 2026-01-20 LTS
OpenJDK Runtime Environment Temurin-25.0.2+10 (build 25.0.2+10-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.2+10 (build 25.0.2+10-LTS, mixed mode, sharing)
如果您有多个版本,可以使用 alternatives 进行配置:
update-alternatives --config 'java'
apt install -y wget apt-transport-https gpg
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
apt update
apt install -y temurin-25-jdk
检查 Java 版本:
java --version
openjdk 25.0.2 2026-01-20 LTS
OpenJDK Runtime Environment Temurin-25.0.2+10 (build 25.0.2+10-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.2+10 (build 25.0.2+10-LTS, mixed mode, sharing)
如果您有多个版本,可以使用 alternatives 进行配置:
update-alternatives --config 'java'
apt install -y wget apt-transport-https gpg
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
apt install -y temurin-25-jdk
检查 Java 版本:
java --version
openjdk 25.0.2 2026-01-20 LTS
OpenJDK Runtime Environment Temurin-25.0.2+10 (build 25.0.2+10-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.2+10 (build 25.0.2+10-LTS, mixed mode, sharing)
如果您有多个版本,可以使用 alternatives 进行配置:
update-alternatives --config 'java'
brew install --cask temurin@25
检查 Java 版本:
java --version
我们建议更新 JAVA_HOME 环境变量。
只要有可能,L2J 将与最新 LTS(长期支持)版本的 Java 保持兼容。您可以在 此处 查看 Java SE 的路线图。
获取并安装 Git
L2J 在 BitBucket 上使用 Git 作为版本控制系统,请使用它来获取最新版本。
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
winget install -e --id Git.Git
dnf install -y git
apt install -y git
apt install -y git
brew install git
检查 Git 版本:
git --version
我们建议直接从 我们的 公共公共仓库获 取源代码。
获取并安装数据库服务器
下载并安装数据库服务器并创建一个特定用户。
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
winget install -e --id MariaDB.Server
dnf install -y mariadb-server
启动服务:
systemctl start mariadb
加固数据库安装:
mysql_secure_installation
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
... Success!
Change the root password? [Y/n] n
... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
apt install -y mariadb-server
加固数据库安装:
mysql_secure_installation
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
... Success!
Change the root password? [Y/n] n
... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
apt install -y mariadb-server
加固数据库安装:
mysql_secure_installation
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
... Success!
Change the root password? [Y/n] n
... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
brew install mariadb
启动服务:
brew services start mariadb
加固数据库安装:
mariadb-secure-installation
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
... Success!
Change the root password? [Y/n] n
... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
执行以下 SQL 语句来创建一个 L2J 特定的数据库用户:
mariadb -u root -p
CREATE OR REPLACE USER 'l2j'@'%' IDENTIFIED BY 'l2jserver2019';
GRANT ALL PRIVILEGES ON *.* TO 'l2j'@'%' IDENTIFIED BY 'l2jserver2019';
FLUSH PRIVILEGES;
exit
我们建议更改默认数据库密码。如果您更改了密码,则需要编辑游戏服务器 config 文件夹和登录服务器 config 文件夹中的 database.properties 文件。
L2J 与 MySQL 8.0+ 兼容,但我们推荐使用 MariaDB。
安装 Unzip
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
Windows 不需要该软件。
稍后在部署编译后的服务器文件时将使用 Unzip 工具。
apt install -y unzip
稍后在部署编译后的服务器文件时将使用 Unzip 工具。
apt install -y unzip
稍后在部署编译后的服务器文件时将使用 Unzip 工具。
apt install -y unzip
macOS 不需要该软件。
获取源代码
官方的仓库列表如下:
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
mkdir C:\opt\l2j\git
cd C:\opt\l2j\git
mkdir -p /opt/l2j/git
cd /opt/l2j/git
mkdir -p /opt/l2j/git
cd /opt/l2j/git
mkdir -p /opt/l2j/git
cd /opt/l2j/git
mkdir -p ~/l2j/git
cd ~/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.
develop 分支包含 High Five 的最新版本,master 分支包含 High Five 的稳定版本。
其他选项有 Interlude, Epilogue, Freya 等。
编译服务器
我们使用 Maven 编译服务器文件,请执行以下命令:
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
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
...
cd /opt/l2j/git/l2j-server-login
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.l2jserver:l2j-server-login >-------------------
[INFO] Building L2J Login Server 2.6.1.6
...
cd /opt/l2j/git/l2j-server-game
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.l2jserver:l2j-server-game >--------------------
[INFO] Building L2J Game Server 2.6.2.0-SNAPSHOT
...
cd /opt/l2j/git/l2j-server-datapack
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.l2jserver:l2j-server-datapack >------------------
[INFO] Building L2J DataPack 2.6.2.0-SNAPSHOT
...
cd /opt/l2j/git/l2j-server-login
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.l2jserver:l2j-server-login >-------------------
[INFO] Building L2J Login Server 2.6.1.6
...
cd /opt/l2j/git/l2j-server-game
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.l2jserver:l2j-server-game >--------------------
[INFO] Building L2J Game Server 2.6.2.0-SNAPSHOT
...
cd /opt/l2j/git/l2j-server-datapack
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.l2jserver:l2j-server-datapack >------------------
[INFO] Building L2J DataPack 2.6.2.0-SNAPSHOT
...
cd /opt/l2j/git/l2j-server-login
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.l2jserver:l2j-server-login >-------------------
[INFO] Building L2J Login Server 2.6.1.6
...
cd /opt/l2j/git/l2j-server-game
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.l2jserver:l2j-server-game >--------------------
[INFO] Building L2J Game Server 2.6.2.0-SNAPSHOT
...
cd /opt/l2j/git/l2j-server-datapack
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.l2jserver:l2j-server-datapack >------------------
[INFO] Building L2J DataPack 2.6.2.0-SNAPSHOT
...
cd ~/l2j/git/l2j-server-login
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.l2jserver:l2j-server-login >-------------------
[INFO] Building L2J Login Server 2.6.1.6
...
cd ~/l2j/git/l2j-server-game
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.l2jserver:l2j-server-game >--------------------
[INFO] Building L2J Game Server 2.6.2.0-SNAPSHOT
...
cd ~/l2j/git/l2j-server-datapack
chmod 755 mvnw
./mvnw install
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.l2jserver:l2j-server-datapack >------------------
[INFO] Building L2J DataPack 2.6.2.0-SNAPSHOT
...
为了避免以下警告
[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
您需要从 NIST 获取 API Key 并将环境变量 NVD_API_KEY 设置为该 Key。
如果 API Key 存在,它将被用于获 取漏洞数据库文件。
部署服务器
目前的部署过程只需解压编译后的文件。
部署登录服务器
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
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
mkdir -p /opt/l2j/server/login
cd /opt/l2j/server/login
unzip /opt/l2j/git/l2j-server-login/target/l2j-server-login-*.zip -d /opt/l2j/server/login
mkdir -p /opt/l2j/server/login
cd /opt/l2j/server/login
unzip /opt/l2j/git/l2j-server-login/target/l2j-server-login-*.zip -d /opt/l2j/server/login
mkdir -p /opt/l2j/server/login
cd /opt/l2j/server/login
unzip /opt/l2j/git/l2j-server-login/target/l2j-server-login-*.zip -d /opt/l2j/server/login
mkdir -p ~/l2j/server/login
cd ~/l2j/server/login
unzip ~/l2j/git/l2j-server-login/target/l2j-server-login-*.zip -d ~/l2j/server/login
部署游戏服务器
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
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-*.zip
tar -xf C:\opt\l2j\git\l2j-server-datapack\target\l2j-server-datapack-*.zip
mkdir -p /opt/l2j/server/game
cd /opt/l2j/server/game
unzip /opt/l2j/git/l2j-server-game/target/l2j-server-game-*.zip -d /opt/l2j/server/game
unzip /opt/l2j/git/l2j-server-datapack/target/l2j-server-datapack-*.zip -d /opt/l2j/server/game
mkdir -p /opt/l2j/server/game
cd /opt/l2j/server/game
unzip /opt/l2j/git/l2j-server-game/target/l2j-server-game-*.zip -d /opt/l2j/server/game
unzip /opt/l2j/git/l2j-server-datapack/target/l2j-server-datapack-*.zip -d /opt/l2j/server/game
mkdir -p /opt/l2j/server/game
cd /opt/l2j/server/game
unzip /opt/l2j/git/l2j-server-game/target/l2j-server-game-*.zip -d /opt/l2j/server/game
unzip /opt/l2j/git/l2j-server-datapack/target/l2j-server-datapack-*.zip -d /opt/l2j/server/game
mkdir -p ~/l2j/server/game
cd ~/l2j/server/game
unzip ~/l2j/git/l2j-server-game/target/l2j-server-game-*.zip -d ~/l2j/server/game
unzip ~/l2j/git/l2j-server-datapack/target/l2j-server-datapack-*.zip -d ~/l2j/server/game
文件名可能会随着每个新版本的发布而改变,请注意这一点。
安装数据库
获取 L2J CLI
L2J CLI 是一个允许我们实施自动化部署和初始配置的工具。
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
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
mkdir -p /opt/l2j/cli
cd /opt/l2j/cli
wget https://l2jserver.com/api/download/cli/latest -O /tmp/l2jcli-latest.zip
unzip /tmp/l2jcli-latest.zip -d /opt/l2j/cli
chmod 755 l2jcli.sh
mkdir -p /opt/l2j/cli
cd /opt/l2j/cli
wget https://l2jserver.com/api/download/cli/latest -O /tmp/l2jcli-latest.zip
unzip /tmp/l2jcli-latest.zip -d /opt/l2j/cli
chmod 755 l2jcli.sh
mkdir -p /opt/l2j/cli
cd /opt/l2j/cli
wget https://l2jserver.com/api/download/cli/latest -O /tmp/l2jcli-latest.zip
unzip /tmp/l2jcli-latest.zip -d /opt/l2j/cli
chmod 755 l2jcli.sh
mkdir -p ~/l2j/cli
cd ~/l2j/cli
wget https://l2jserver.com/api/download/cli/latest -O /tmp/l2jcli-latest.zip
unzip /tmp/l2jcli-latest.zip -d ~/l2j/cli
chmod 755 l2jcli.sh
配置 CLI
在 config 文件夹中编辑 login-server.properties 和 game-server.properties 文件,根据为数据库配置的用户名和密码配置 DatabaseUser 和 DatabasePassword。
执行 CLI
运行 l2jcli.bat 并执行以下命令:
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
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
./l2jcli.sh
db install -sql /opt/l2j/server/login/sql -u l2j -p l2jserver2019 -m FULL -t LOGIN -c -mods
db install -sql /opt/l2j/server/game/sql -u l2j -p l2jserver2019 -m FULL -t GAME -c -mods
./l2jcli.sh
db install -sql /opt/l2j/server/login/sql -u l2j -p l2jserver2019 -m FULL -t LOGIN -c -mods
db install -sql /opt/l2j/server/game/sql -u l2j -p l2jserver2019 -m FULL -t GAME -c -mods
./l2jcli.sh
db install -sql /opt/l2j/server/login/sql -u l2j -p l2jserver2019 -m FULL -t LOGIN -c -mods
db install -sql /opt/l2j/server/game/sql -u l2j -p l2jserver2019 -m FULL -t GAME -c -mods
./l2jcli.sh
db install -sql ~/l2j/server/login/sql -u l2j -p l2jserver2019 -m FULL -t LOGIN -c -mods
db install -sql ~/l2j/server/game/sql -u l2j -p l2jserver2019 -m FULL -t GAME -c -mods
参数说明:
| 参数 | 说明 |
|---|---|
| -sql path | SQL 文件路径 |
| -u user | 数据库用户 |
| -p password | 数据库密码 |
| -m mode | 安装模式 FULL 或 UPDATE |
| -t type | 服务器类型 LOGIN 或 GAME |
| -c | 安装自定义表 |
| -mods | 安装模块表 |
创建管理员账户
使用 L2J CLI 创建管理员账户,8 是最高的账户级别(master):
account create -u Zoey76 -p -a 8
quit
打开服务器端口
如果您不是从 localhost 玩游戏,您可能需要在服务器上打开一些端口。
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
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
此操作需要提升的命令提示符。请以管理员身份运行命令提示符。
firewall-cmd --zone=public --add-port=2106/tcp --permanent
firewall-cmd --zone=public --add-port=7777/tcp --permanent
firewall-cmd --reload
ufw allow 2106/tcp
ufw allow 7777/tcp
ufw allow 2106/tcp
ufw allow 7777/tcp
macOS 不需要该操作。
作为玩家连接到服务器仅需要这些端口。
地理数据 (Geodata)
L2J Server 使用地理数 据文件将环境信息包含进服务器。
您可以编辑游戏服务器 config 文件夹内的 geodata.properties 来配置它。
Geodata 应该放置在 data/geodata 文件夹内,您可以编辑 GeoDataPath 属性来更改路径。
您可以从 此处 下载 High Five 的最新版本。
启动服务器
初始配置
这些命令会创建日志所需的文件夹并授予脚本访问权限。
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
Windows 不需要该操作。
cd /opt/l2j && mkdir -p custom
cd /opt/l2j/server/login && mkdir -p log
chmod 755 LoginServer_loop.sh
chmod 755 startLoginServer.sh
cd /opt/l2j/server/game && mkdir -p log
chmod 755 GameServer_loop.sh
chmod 755 startGameServer.sh
cd /opt/l2j && mkdir -p custom
cd /opt/l2j/server/login && mkdir -p log
chmod 755 LoginServer_loop.sh
chmod 755 startLoginServer.sh
cd /opt/l2j/server/game && mkdir -p log
chmod 755 GameServer_loop.sh
chmod 755 startGameServer.sh
cd /opt/l2j && mkdir -p custom
cd /opt/l2j/server/login && mkdir -p log
chmod 755 LoginServer_loop.sh
chmod 755 startLoginServer.sh
cd /opt/l2j/server/game && mkdir -p log
chmod 755 GameServer_loop.sh
chmod 755 startGameServer.sh
cd ~/l2j && mkdir -p custom
cd ~/l2j/server/login && mkdir -p log
chmod 755 LoginServer_loop.sh
chmod 755 startLoginServer.sh
cd ~/l2j/server/game && mkdir -p log
chmod 755 GameServer_loop.sh
chmod 755 startGameServer.sh
启动服务器
要启动服务器,您需要运行两个脚本:一个用于游戏服务器,另一个用于登录服务器。
- Windows
- Centos Stream 10
- Debian 13
- Ubuntu 22
- macOS Sequoia 15
C:\opt\l2j\server\login\startLoginServer.bat
C:\opt\l2j\server\game\startGameServer.bat
cd /opt/l2j/server/login
./startLoginServer.sh
cd /opt/l2j/server/game
./startGameServer.sh
可选操作,通过查看日志检查服务器是否已正确启动:
tail -f -n 300 /opt/l2j/server/login/log/stdout.log
[INFO ] 2023-01-17 02:03:51 LoginController: Loading Login Controller...
[INFO ] 2023-01-17 02:03:52 LoginController: Cached 10 KeyPairs for RSA communication.
[INFO ] 2023-01-17 02:03:52 LoginController: Stored 20 keys for Blowfish communication.
[INFO ] 2023-01-17 02:03:52 HikariDataSource: HikariPool-1 - Starting...
[INFO ] 2023-01-17 02:03:53 HikariDataSource: HikariPool-1 - Start completed.
[INFO ] 2023-01-17 02:03:53 GameServerTable: GameServerTable: Loaded 0 registered Game Servers.
[INFO ] 2023-01-17 02:03:53 GameServerTable: GameServerTable: Cached 10 RSA keys for Game Server communication.
[INFO ] 2023-01-17 02:03:53 LoginServer: Loaded 2 banned IPs.
[INFO ] 2023-01-17 02:03:53 LoginServer: Listening for game servers on 127.0.0.1:9014.
[INFO ] 2023-01-17 02:03:53 LoginServer: Telnet server is currently disabled.
[INFO ] 2023-01-17 02:03:53 LoginServer: Login Server is now listening on *:2106.
[INFO ] 2023-01-17 02:03:53 UPnPService: Looking for UPnP Gateway Devices...
[INFO ] 2023-01-17 02:04:02 UPnPService: No UPnP gateways has been found.
cd /opt/l2j/server/login
./startLoginServer.sh
cd /opt/l2j/server/game
./startGameServer.sh
可选操作,通过查看日志检查服务器是否已正确启动:
tail -f -n 300 /opt/l2j/server/login/log/stdout.log
[INFO ] 2023-01-17 02:03:51 LoginController: Loading Login Controller...
[INFO ] 2023-01-17 02:03:52 LoginController: Cached 10 KeyPairs for RSA communication.
[INFO ] 2023-01-17 02:03:52 LoginController: Stored 20 keys for Blowfish communication.
[INFO ] 2023-01-17 02:03:52 HikariDataSource: HikariPool-1 - Starting...
[INFO ] 2023-01-17 02:03:53 HikariDataSource: HikariPool-1 - Start completed.
[INFO ] 2023-01-17 02:03:53 GameServerTable: GameServerTable: Loaded 0 registered Game Servers.
[INFO ] 2023-01-17 02:03:53 GameServerTable: GameServerTable: Cached 10 RSA keys for Game Server communication.
[INFO ] 2023-01-17 02:03:53 LoginServer: Loaded 2 banned IPs.
[INFO ] 2023-01-17 02:03:53 LoginServer: Listening for game servers on 127.0.0.1:9014.
[INFO ] 2023-01-17 02:03:53 LoginServer: Telnet server is currently disabled.
[INFO ] 2023-01-17 02:03:53 LoginServer: Login Server is now listening on *:2106.
[INFO ] 2023-01-17 02:03:53 UPnPService: Looking for UPnP Gateway Devices...
[INFO ] 2023-01-17 02:04:02 UPnPService: No UPnP gateways has been found.
cd /opt/l2j/server/login
./startLoginServer.sh
cd /opt/l2j/server/game
./startGameServer.sh
可选操作,通过查看日志检查服务器是否已正确启动:
tail -f -n 300 /opt/l2j/server/login/log/stdout.log
cd ~/l2j/server/login
./startLoginServer.sh
cd ~/l2j/server/game
./startGameServer.sh
可选操作,通过查看日志检查服务器是否已正确启动:
tail -f -n 300 ~/l2j/server/login/log/stdout.log
连接到服务器
要连接到服务器,您 有以下选择:
HOSTS 文件
编辑 C:\Windows\System32\drivers\etc\hosts 并添加此行:
127.0.0.1 l2authd.lineage2.com
BAT 文件
创建一个包含以下内容的 .bat 文件:
@start l2.bin IP=127.0.0.1
自定义 exe
这是一个 C++ Win32 exe 示例:
#define _WIN32_WINNT _WIN32_WINNT_WINXP
#define NOMINMAX
#include <windows.h>
#include <cstdlib>
// 以 .bin 启动 L2,并将 IP 作为参数。
// 您可以使用 IP 或 DNS 作为 IP 参数。
// 您可以包含其他参数。
// 您可以更改 .bin 文件的路径,以避免在 System 文件夹中包含 L2.exe。
// 作者: 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);
}
L2J 不允许修改客户端,这包括 GameGuard 和 L2.ini 的更改。