Versão avaliada: Debian13 (Trixie) + L2J + Java 25 SDK + MariaDB
Instalar as dependências:
# apt install openjdk-25-jdk git mariadb-server unzip
echo "export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))" >> ~/.bashrc
source ~/.bashrc
ufw allow 2106/tcp
ufw allow 7777/tcp
ufw allow 3306/tcp
# mariadb-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): <Press Enter>
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] <Press Enter>
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] <Press n>
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] <Press Enter>
... 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] <Press Enter>
... skipping.
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] <Press Enter>
- 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] <Press Enter>
... 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!
# vi /etc/mysql/mariadb.conf.d/50-server.cnf
#bind-address = 127.0.0.1
# systemctl restart mariadb.service
# mariadb -u root -p
grant all privileges on *.* to root@'localhost' identified by '<SenhaRoot>' with grant option;
grant all privileges on *.* to root@'%' identified by '<SenhaRoot>' with grant option;
FLUSH PRIVILEGES;
CREATE DATABASE IF NOT EXISTS l2jls CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE DATABASE IF NOT EXISTS l2jgs CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON l2jls.* TO 'l2j'@'localhost' IDENTIFIED BY 'l2jserver2019'; <- nao sera possivel logar externamente
GRANT ALL PRIVILEGES ON l2jgs.* TO 'l2j'@'localhost' IDENTIFIED BY 'l2jserver2019'; <- nao sera possivel logar externamente
FLUSH PRIVILEGES;
# mkdir -p /opt/l2j/git
# cd /opt/l2j/git/
# git clone -b master https://bitbucket.org/l2jserver/l2j-server-login.git
# git clone -b develop https://bitbucket.org/l2jserver/l2j-server-game.git
# git clone -b develop https://bitbucket.org/l2jserver/l2j-server-datapack.git
# cd /opt/l2j/git/l2j-server-login
####################### cd /opt/l2j/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
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.623 s
[INFO] Finished at: 2024-11-16T19:03:15-03:00
[INFO] ------------------------------------------------------------------------
# cd /opt/l2j/git/l2j-server-game
########## cd /opt/l2j/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
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:40 min
[INFO] Finished at: 2024-11-16T19:10:37-03:00
[INFO] ------------------------------------------------------------------------
# cd /opt/l2j/git/l2j-server-datapack
######### cd /opt/l2j/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
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:12 min
[INFO] Finished at: 2024-11-16T19:14:54-03:00
[INFO] ------------------------------------------------------------------------
# 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/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
O CLI é utilizado para popular a base de dados com as tabelas e o conteúdo inicial.
# 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
# cd /opt/l2j/cli
# ./l2jcli.sh
>>> db install -sql /opt/l2jserver/server/login/sql -u l2j -p l2jserver2019 -m FULL -t LOGIN -c -mods
>>> db install -sql /opt/l2jserver/server/game/sql -u l2j -p l2jserver2019 -m FULL -t GAME -c -mods
Parâmetros para usar no CLI:
Parameter Description
-sql path Path to SQL files
-u user Database user
-p password Database password
-m mode Installation mode FULL or UPDATE
-t type Server type LOGIN or GAME
-c Install custom tables
-mods Install mods tables
Criar Conta de Administrador
>>> account create -u admin -p -a 8
Enter value for --password (Password):
Creating account admin...
>>> quit
Unregister e Register gameserver
>>> gameserver unregister -id=1 (gs u -id=0)
>>> gameserver register -id=0
# mkdir -p /opt/l2jserver/geodata
# cd /opt/l2jserver/geodata
# wget https://bitbucket.org/l2jgeo/l2j_geodata/get/master.zip
# unzip master.zip
# mv /opt/l2jserver/geodata/l2jgeo-l2j_geodata-378672ee9bff/geodata/* /opt/l2jserver/server/game/data/geodata
O arquivo abaixo realiza a configuração de rede com permissão de acesso:
# vi /opt/l2jserver/server/game/config/ipconfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Put old contents of ExternalHostname here, used by default -->
<gameserver address="10.1.10.244" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ipconfig.xsd">
<!-- Localhost here -->
<define subnet="127.0.0.0/8" address="127.0.0.1" />
<!-- Internalhosts here (LANs IPs) -->
<define subnet="10.0.0.0/8" address="10.1.10.244" />
<define subnet="172.16.0.0/19" address="172.16.0.0" />
<define subnet="192.168.0.0/16" address="192.168.0.0" />
</gameserver>
Iniciar os Servidores
# cd /opt/l2j/server/login && mkdir -p log
# chmod 755 LoginServer_loop.sh startLoginServer.sh
# cd /opt/l2j/server/game && mkdir -p log
# chmod 755 GameServer_loop.sh startGameServer.sh
# cd /opt/l2j/server/login
# ./startLoginServer.sh
# tail -f -n 300 log/stdout.log
# cd /opt/l2j/server/game
# ./startGameServer.sh
# tail -f -n 300 log/stdout.log
# pkill GameServer && pkill LoginServer && killall java && killall java
# killall LoginServer_loop.sh && killall GameServer_loop.sh && killall java && killall java
(Em Desenvolvimento)
Instalar Debian e dependências
# apt install openjdk-8-jdk openjdk-8-jre git
Instalar e configurar o MariaDB
# apt install mariadb-server mysqltuner
Nota: mais configurações acesse o link.
# vi /etc/mysql/mysql.conf.d/mysqld.cnf
#bind-address = 127.0.0.1
# /etc/init.d/mysql restart
# mysql -u root -p
> grant all privileges on *.* to root@'%' identified by 'mysql@123' with grant option;
> flush privileges;
> quit
Nota: É necessário definir ao menos localhost para root para inserir na database com o comando startSQLAccountManager.sh
Instalar e configurar o samba (OPCIONAL)
# apt-get install samba
# vi /etc/samba/smb.conf
#======================= Global Settings =======================
[global]
workgroup = WORKGROUP
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
#======================= Share Definitions =======================
[L2JServer]
comment = L2J Directories
public = yes
path = /home/l2jserver
browseable = yes
read only = no
create mask = 0777
directory mask = 0777
Baixar o projeto l2jserver no Eclipse via Git
https://bitbucket.org/l2jserver/l2j_server/wiki/Home
https://bitbucket.org/l2jserver/l2j_server
https://bitbucket.org/l2jserver/l2j_datapack
SVN (http://svn.l2jdp.com/trunk/ e http://svn.l2jserver.com/trunk/)
* TESTAR com esse ajuste
-> Create Databases: l2jls , l2jgs and l2jcs (use utf8mb4_unicode_ci encoding)
-> Browse to yourserverfolder/tools
-> Run Dbinst_cs.jar (Community Server)
-> Fill in with your Mysql information.
-> Select Full Install
-> Repeat the process for Dbinst_ls.jar (Login Server) and Dbinst_gs.jar (Game Server), thanks to Unafraid
Descompactar no mesmo diretorio o SERVER e o DB sobrepondo.
Acessar o diretório system com o prompt e executar o comando abaixo para validar Protocol Revisions
\LineageII-Helios\system>L2.exe -l2protocolversion
L2ProtocolVersion = 64
Configurar o ambiente do game – Executado em modo visual
\\<IP>\L2JServer\game\L2J_Configurator.jar
Configurar o IP Login Host – 192.168.25.150 127.0.0.1
Configurar o Gameserver Hostname – 192.168.25.150
TESTAR com esse ajuste
GameserverHostname = "MY the IP"
GameserverHosts = 127.0.0.1
GameserverSubnets = 0.0.0.0
Configurar a conexão com a database
Adicionar em Allowed Protocol Revisions o valor 64;
Acessar os arquivos de configuração dos serviços – Executado em modo texto
\\<IP>\L2JServer\login\config\LoginServer.properties
Configurar LoginserverHostname = 192.168.25.150
Configurar LoginHostname = 192.168.25.150
Configurar a conexão com a database
Configurar AutoCreateAccounts = False
Instalar a data base – Executado em modo visual
\\<IP>\L2JServer\tools\dbinst_ls.jar <- login server
Escolha entre Full Install ou Upgrade.
\\<IP>\L2JServer\tools\dbinst_gs.jar <- game server
Escolha entre Full Install ou Upgrade.
Clique em OK para instalar as tabelas Custom e Mode.
Descompacte os arquivos geodata
\\<IP>\L2JServer\game\data\geodata
Registrar o server com o comando sh RegisterGameServer.sh e após copiar o arquivo hexid.txt em /L2JServer/game/config
GSRegister
# sh /home/l2jserver/login/RegisterGameServer.sh
1 - Register GameServer
2 - List GameServers Names and IDs
3 - Remove GameServer
4 - Remove ALL GameServers
5 - Exit
Choice: 1
Enter desired ID:
1
5
# mv hexid.txt /home/l2jserver/game/config/
Acessar em modo console e executar startSQLAccountManager.sh para criar o usuario admin
# sh /home/l2jserver/login/startSQLAccountManager.sh
Please choose an option
1 - Create new account or update existing one (change pass and access level)
2 - Change access level
3 - Delete existing account
4 - List accounts and access levels
5 - Exit
Your choice: 1
Username: admin@admin.local)
Password: admin
Access level: 100
Account admin@admin.local has been created or updated
5
Executar o login server
# mkdir /home/l2jserver/login/log
# sh /home/l2jserver/login/startLoginServer.sh
Os logs podem ser acompanhados no arquivo L2JServer\login\log\stdout.log
Executar o game server
# mkdir /home/l2jserver/game/log
# sh /home/l2jserver/game/startGameServer.sh
Os logs podem ser acompanhados no arquivo L2JServer\game\log\stdout.log do diretorio de log
http://www.l2jserver.com/forum/viewtopic.php?t=30573
Executando o game
https://github.com/Zoey76/L2
Download client http://www.lineage2.org.uk
Ajustar o C:\Windows\System32\drivers\etc\hosts para
192.168.25.150 L2authd.Lineage2.com
#216.107.250.194 nprotect.lineage2.com
http://www.wikihow.com/Set-up-an-L2J-Server <- metodo 4
Logar usando o usuario admin@admin.local e senha admin
\> start L2.bin -ServerAddr=192.168.25.150 -UseEMailAccount=false
\> start "system\L2.bin" -ServerAddr=192.168.25.150 -UseEMailAccount=false
\> start "system\L2.bin" IP=192.168.25.150 -UseEMailAccount=false
* Criar arquivo texto com o comando start acima e salvar como bat ou cmd
* Após o acesso ao game digite \\admin para abrir o console admin do game