L2J Server on CentOS 7.6+
转码有些乱,大家直接访问原文进行学习吧{:1_134:}
Update and Upgrade your OS CentOS 7.6+ comes with OpenJDK 11.
- cat /etc/centos-release
- dhclient
- yum update
复制代码 Install OpenJDK L2J is built using Java SE, to build you need Java JDK as well.
- yum -y install java-11-openjdk java-11-openjdk-devel
- java -version
- openjdk version "11.0.4" 2019-07-16 LTS
复制代码We recommend OpenJDK due to licencing changes from Oracle.
We use OpenJDK 11 since it is the lastest stable LTS.
Install Git L2J uses Git as version control system on BitBucket, use it to get the latest versions.
We recommend getting the source code directly from our public repositories.
Install Maven L2J uses Maven to build the components from the source code.
- <pre class="command-line language-shell" data-user="zoey76" data-host="l2jserver" data-output="5-9"><code class=" language-shell"><span class="token function">wget</span> https://www-us.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P /tmp
- <span class="token function">tar</span> xf /tmp/apache-maven-*-bin.tar.gz -C /opt
- <span class="token function">ln</span> -s /opt/apache-maven-3.6.3 /opt/maven
- <span class="token function">vi</span> /etc/profile.d/maven.sh
- # Paste
- export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.4.11-0.el7_6.x86_64/
- export M2_HOME=/opt/maven
- export MAVEN_HOME=/opt/maven
- export PATH=${M2_HOME}/bin:${PATH}
- <span class="token function">chmod</span> +x /etc/profile.d/maven.sh
- <span class="token builtin class-name">source</span> /etc/profile.d/maven.sh</code></pre>
复制代码 Install the Database Server Get latest version from here.
- vi /etc/yum.repos.d/MariaDB.repo
- # MariaDB 10.4 CentOS repository list - created 2019-08-11 20:34 UTC
- # http://downloads.mariadb.org/mariadb/repositories/
- [mariadb]
- name = MariaDB
- baseurl = http://yum.mariadb.org/10.4/centos7-amd64
- gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
- gpgcheck=1
- yum install MariaDB-server MariaDB-client
复制代码- mariadb -u root -p
- MariaDB > CREATE OR REPLACE USER 'l2j'@'%' IDENTIFIED BY 'l2jserver2019';
- MariaDB > GRANT ALL PRIVILEGES ON *.* TO 'l2j'@'%' IDENTIFIED BY 'l2jserver2019';
- MariaDB > FLUSH PRIVILEGES;
复制代码 Get the Source Code Our official repositories are the ones listed bellow.
- mkdir -p /opt/l2j/git && cd /opt/l2j/git
- git clone https://bitbucket.org/l2jserver/l2j-server-login.git
- git clone https://bitbucket.org/l2jserver/l2j-server-game.git
- git clone https://bitbucket.org/l2jserver/l2j-server-datapack.git
复制代码 Build the Server from Source Code We use Maven to build the server files.
- cd /opt/l2j/git/l2j-server-login && mvn install
- cd /opt/l2j/git/l2j-server-game && mvn install
- cd /opt/l2j/git/l2j-server-datapack && mvn install
复制代码 Deploy the Server The deployment process at the moment is simply unzipping the built files.
- mkdir -p /opt/l2j/server/login
- unzip /opt/l2j/git/l2j-server-login/target/l2jlogin-*.zip -d /opt/l2j/server/login
- mkdir -p /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
复制代码 The file names may change with each new version, take that into consideration.
Get L2J CLI and Install the Database L2J CLI is a tool developed by Zoey76 that allows us to implement automated deployments and initial configurations.
- mkdir -p /opt/l2j/cli && cd /opt/l2j/cli
- wget CLI_LINK -P /tmp
- unzip /tmp/l2jcli-*.zip -d /opt/l2j/cli
- chmod 755 l2jcli.sh
- ./l2jcli.sh
复制代码 Initial Configuration You need to give certain permissions for the server to run properly.
- 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
复制代码 Create Administrator Account Use the L2J CLI to create an administrator account, 8 is the maximum account level (master).
- cd /opt/l2j/cli
- ./l2jcli.sh
复制代码 Start the Server To start the server you need to run two scripts.
- cd /opt/l2j/server/login
- ./startLoginServer.sh
- cd /opt/l2j/server/game
- ./startGameServer.sh
复制代码 Open Server Ports If you are not playing from localhost you may need to open the following ports.
- firewall-cmd --zone=public --add-port=2106/tcp --permanent
- firewall-cmd --zone=public --add-port=7777/tcp --permanent
- firewall-cmd --reload
复制代码 Only this ports are required to connect to the server as a player.
Connect to the Server In order 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);
- }
复制代码 Download compiled version from here.
More information here.
Client modification are not allowed in L2J, this include GameGuard and L2.ini changes.
|