L2JMobius

The Kamael [GUIDE] Install L2JMobius on Debian 10.

f5inet · 12 · 13772

Offline f5inet

  • Vassal
  • *
    • Posts: 1
So, you want to install L2JMobius on Debian 10, because you don't want to pay more for a Windows License, or do you prefer Open Source Software.

Whatever, there is your guide. First, you need a dedicaded server. for starters and going cheap, you can try out kimsufi.com, backed by OVH, the third/fourth biggest worldwide server provider, in France.

The biggest problem is JAVA 14, because for debian 10, the 'default JDK/JRE' is Java 11, so, we need to install the Java 14 JDK manually and set as the default runtime for Java. Once this problem is solved, the guide is very simple.

This guide helps you to install L2JMobius directly from source. if you have a precompiled version of L2JMobius already prepared, the guide is simpler.


0.- PREPARING
first, I assume you are using Windows, so, you need a few programs to interactuate with the server. You need PUTTY and WINSCP. These programs are very easy to found, download and install.

Install both programs, and try to connect to the server. Putty allows to connect to terminal text. WinSCP allows you to copy to and from the server with a graphical interface.

Usually, debian 10 uses a standard user, and you need to run 'elevated' commands with 'sudo' before. if you have a 'root' user/password, you can omit all 'sudo' in the commands.


1.- INSTALL MARIADB
Connect through putty to your server. update your system and upgrade installed packages:

Quote
sudo apt -y update

sudo apt -y install software-properties-common gnupg2

sudo apt -y upgrade

sudo reboot

We need to import MariaDB gpg key which contains the keys used for signing MariaDB Debian packages. Then add the MariaDB repository to your system:

Quote
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8

sudo add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.liquidtelecom.com/repo/10.4/debian buster main'

After addition of the repository, installation of MariaDB 10.4 server and client packages can be done by running the following commands in your terminal.

Quote
sudo apt update

sudo apt install mariadb-server mariadb-client

Now run the secure script to set root password, remove test database and disable remote root user login.

Quote
sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password:
Re-enter new password:

Password updated successfully!
Reloading privilege tables..
 ... Success!


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!

OK. MariaDB installed. moving on... remember to get note of the NEW mariadb root password that you set if the previous step.


2.- INTERLUDE, INSTALL REQUIRED SOFTWARE

Install Midnight commander, to get a text/graphical interface for browsing quickly and edit files. also, we need 'ant' to compile L2JMobius and 'git' to download L2JMobius

Quote
sudo apt install mc ant git


3.- INSTALL ORACLE JDK14

As we say before, the biggest problem is JAVA 14, But, thanks to the new repository from LinuxUprising, is very easy.

Quote
sudo apt update

sudo add-apt-repository ppa:linuxuprising/java

sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys EA8CACC073C3DB2A

sudo apt update

sudo apt -y install oracle-java14-installer

sudo apt -y install oracle-java14-set-default

java -version

If you have done every step, you will have Java version "14.0.2" or higher.


4.- DOWNLOAD AND COMPILE L2JMOBIUS FREE

We are downloading and compiling the source code. if you have the server pack already compiled, just upload to the server using WINSCP and skip this step.

Quote
git clone https://bitbucket.org/MobiusDev/l2j_mobius.git

cd l2j_mobius

now, enter in the server version that you want to compile, and compile it with 'ant. Here, I am going to compile CT_2.6_HighFive

Quote
cd L2J_Mobius_CT_2.6_HighFive

ant

cd ..

cd build

mc

and here, you will have the ZIP of the compiled server. now, just copy it to the desired location using 'mc'. navigate in the right panel (using 'tab' to change between panels) and press F5 to copy the selected file to the other panel. press F10 to exit 'mc'.


5.- UNZIP, CONFIGURE AND RUN THE SERVER

Go to where you have the ZIP of the server, and unzip it

Quote
unzip file.zip

Because a bug in the ant compiling and building, the 'scripts' (.sh) aren't set the execute flag, so we need to set the execute flag in every .sh files. Also,because the same bug, we need to create manually the 'log' directories

Quote
cd login

chmod +x *.sh

mkdir log

cd ..

cd game

chmod +x *.sh

mkdir log

cd ..

Now, we'll install the database. you can accept the defaults, except the password, that you must provide the mariaDB password that we change in the step 2. Also, choose Clean install and destroy the previous DB.

Quote
cd db_installer

java -jar Database_Installer_LS.jar

java -jar Database_Installer_GS.jar

cd ..

Now, it's time to setup and run the loginserver. with 'mc', edit the login/config/LoginServer.ini. press F4 inside 'mc' to edit the file. If 'mc' ask for the editor, choose 'mcedit', because is integrated inside 'mc' and is easier than nano or vim. Here, you only need to setup Database Password. Fill it up, save with F2, and press F10 to exit the editor.

Do the same with game/config/Server.ini, and setup the mariaDB password. (F4 enter editor, F2 save, F10 exit editor)

Now it's the moment to copy the geodata. download it directly with 'wget' and 'unzip' it, or download in your PC, upload it using WinSCP and copy to the final directory (game/dat/geodata) using 'mc'. The Geodata download link is in the Readme.txt of the compiled server, along with the client download link.

finally, run the loginserver and the game server. You can run manually entering in the directories, or launch them through 'mc'. You must launch 'login/LoginServer.sh' and 'game/GameServer.sh'


6.- ENDGAME, STATUS AND STOPING THE SERVER

To view the status, you can enter the 'log' directories in the login and game, and press F3 (inside 'mc') to view the stdout.log of them, to view the output of both servers separately.

To view the comsumption of the servers, and to stop them, you can use the command 'top'. If it's the first time running it, you can setup to view it more beautiful: press 'z' (colour), '1' (separate CPU report), 'c' (view full command line), 'M' (upper 'm', order by memory comsumption), 's' (speed of refresh, set it up to 0.25 or 0.5), and, finally, press 'W' (upper 'w', to write the configuration).



If you press 'q', you exit the 'top' utility. If you press 'k' you can 'kill' (Close) a proccess, inputing the PID number and acepting the '15' reason'. The LoginServer reboots automaticaly, but with the GameServer, you need to relaunch it.


AND THAT'S ALL

Now you have a running L2JMobius server.







Offline syon

  • Vassal
  • *
    • Posts: 6
Great tutorial! Thanks! I followed everything and it worked till getting to the log in part. It shows a down server with 9999 ping. Any ideas of what could be the problem? I tried opening all ports I could think of related to the server. It might be something with my system even though I downloaded it from the readme file. It's an interlude server.



Thanks,


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 333
Check game/log/java0.log to see if the gameserver is actually connected to the login.


Offline l2retro

  • Heir
  • **
    • Posts: 10
Code: [Select]
root@vmi648819:~/l2j_mobius/L2J_Mobius_CT_2.6_HighFive# ant
Buildfile: /root/l2j_mobius/L2J_Mobius_CT_2.6_HighFive/build.xml

checkRequirements:

init:
   [delete] Deleting directory /root/l2j_mobius/build/bin
    [mkdir] Created dir: /root/l2j_mobius/build/bin

compile:
    [javac] Compiling 1855 source files to /root/l2j_mobius/build/bin
    [javac] error: invalid target release: 15
    [javac] Usage: javac <options> <source files>
    [javac] use --help for a list of possible options

BUILD FAILED
/root/l2j_mobius/L2J_Mobius_CT_2.6_HighFive/build.xml:65: Compile failed; see the compiler error output for details.

Total time: 0 seconds

Thanks for the guide. I did everything as described in tutorial, just had to install java manually cause the provided codes dont work anymore, I downloaded and installed jdk-14.0.2_linux-x64_bin.deb from oracle.com.
This is my output for $ java -version:
Code: [Select]
java version "14.0.2" 2020-07-14
Java(TM) SE Runtime Environment (build 14.0.2+12-46)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)
Why am I getting this error during compiling?(Keep in mind im a newby in Linux Os, I just followed this guide from a fresh Debian 10 install.)

***** Update
Installed This:
sudo apt-get update
sudo apt-get install bellsoft-java15

Compile works now, Java 14 step is outdated.






Offline kindiss

  • Vassal
  • *
    • Posts: 1
Hello,

Using this guide I installed L2JMobius on Debian 11. It was some issues with JAVA 17, access rights, ports and memory quantity used for server, but overall very good guide. Thank you!

Regards,
kindiss


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 333
To start/stop the services easier or to check their status, you can run them as services using systemctl.

First, you need to make the files executable.

Code: [Select]
chmod u+x /path/to/game/GameServerTask.sh
chmod u+x /path/to/game/GameServer.sh
chmod u+x /path/to/login/LoginServerTask.sh
chmod u+x /path/to/login/LoginServer.sh

Then, navigate to /etc/systemd/system and create one file named gameserver.service and one loginserver.service.

loginserver.service
Code: [Select]
[Unit]
    Description=LoginServer
    After=network.service hostname.service

[Service]
    Type=simple
    PIDFile=/path/to/login/loginserver.pid
    ExecStart=/path/to/login/LoginServerTask.sh
    ExecStop=/path/to/login/LoginServerTask.sh 0
    ExecReload=/path/to/login/LoginServerTask.sh 2
    User=root
    Group=root
    WorkingDirectory=/path/to/login
[Install]
    WantedBy=multi-user.target

gameserver.service
Code: [Select]
[Unit]
    Description=GameServer
    After=network.service hostname.service

[Service]
    Type=simple
    PIDFile=/path/to/game/gameserver.pid
    ExecStart=/path/to/game/GameServerTask.sh
    ExecStop=/path/to/game/GameServerTask.sh 0
    ExecReload=/path/to/game/GameServerTask.sh 2
#Restart=on-failure
#RestartSec=10
    User=root
    Group=root
    WorkingDirectory=/path/to/game
[Install]
    WantedBy=multi-user.target

Replace /path/to/ with your installation folders.


You can now start the login server using the following command:
Code: [Select]
sudo systemctl start loginserver.serviceYou can check its status by typing
Code: [Select]
sudo systemctl status loginserver.serviceYou can stop it by typing
Code: [Select]
sudo systemctl stop loginserver.serviceYou can restart it by typing
Code: [Select]
sudo systemctl restart loginserver.service
Same applies to gameserver.service.

To make these 2 services to auto-start on boot, type:
Code: [Select]
sudo systemctl enable loginserver.service


Offline syon

  • Vassal
  • *
    • Posts: 6
Thanks for the tip on how to restart or shutdown properly. I was looking for that exactly. Would you know how to send announcements just like the Windows version? On the Windows version, you can click on the menu and select Announcement.

Thanks!


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 333
Thanks for the tip on how to restart or shutdown properly. I was looking for that exactly. Would you know how to send announcements just like the Windows version? On the Windows version, you can click on the menu and select Announcement.

Thanks!

You can't. You can either run them from the game or implement a task manager to read your database and do staff, like announcing.


Online Galagard

  • Heir
  • **
    • Posts: 11
Like that?




I noticed that GUI appears if i change one option in GameServerTask.sh
Code: [Select]
java -Djava.awt.headless=trueto FALSE (but Interface.ini needs to be configured to True)