Private
Protection
Special Offers
Catalog
Auto donation
Preparing Windows Server or Windows 10/11 for an L2 server: Java, the database, firewall ports, power settings, updates, antivirus, autostart and secure remote access.
Old tips for speeding up Windows, such as turning off updates, Task Scheduler and Terminal Services or deleting registry keys, are useless on modern systems and often harmful. Below is what a Java-based Lineage 2 server really needs: stability, the right ports, autostart and protection.
| System | When it fits |
|---|---|
| Windows Server 2022 or 2025 | a dedicated server or VPS for a live project |
| Windows 11 Pro | a home or test server, a small project |
| Windows 10 | support ended in October 2025; for a server exposed to the internet, move to Windows 11 or Windows Server |
Hardware as a rough guide: 8 GB of RAM is enough for a test server, a live project needs 16 GB or more, and an SSD or NVMe drive is a must. Exact requirements depend on the pack and the number of players.
sconfig tool.gpedit.msc, Windows Update section), choose automatic download with notification before install, and install updates during maintenance windows.w32tm /resync in an administrator command prompt.The server must not go to sleep or throttle the CPU under load. In an administrator command prompt:
powercfg /setactive SCHEME_MIN
powercfg /change standby-timeout-ac 0
powercfg /hibernate offSCHEME_MIN is the built-in High performance plan. If it is not available (some laptops and PCs with Modern Standby hide it), keep the Balanced plan but disable sleep. On a regular PC also untick Allow the computer to turn off this device to save power for the network card (Device Manager > network adapter > Properties > Power Management).
JAVA_HOME pointing to the JDK root folder without \bin, for example C:\Program Files\Java\jdk-21.%JAVA_HOME%\bin to the Path variable.You can also create the variable from an administrator PowerShell:
[Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Java\jdk-21", "Machine")Open a new window and check: java -version. where java shows every java.exe found in Path; if there are several, the first one is used.
-Xms and -Xmx. Leave room for the database and the system: the total -Xmx of all processes should be well below the physical RAM.CREATE DATABASE l2game CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'l2user'@'localhost' IDENTIFIED BY 'CHANGE_ME_StrongPass';
GRANT ALL PRIVILEGES ON l2game.* TO 'l2user'@'localhost';
FLUSH PRIVILEGES;The login and game servers may share one database or use two separate ones; check your pack's documentation. Put the database name, user and password into the database connection configs of the login and game servers, then import the pack's SQL files.
sql_mode=NO_ENGINE_SUBSTITUTION to the [mysqld] section of my.ini and restart the service.In the same my.ini section it is worth raising innodb_buffer_pool_size (for example to 1–4 GB depending on RAM). Set up a daily database dump (mysqldump or mariadb-dump) with Task Scheduler and keep the copies on another drive or server.
| Port (TCP) | Purpose | Open to the internet |
|---|---|---|
| 2106 | login server, client connections | yes |
| 7777 | game server, client connections | yes |
| 9014 (sometimes 9013) | game server to login server link | no, only locally or between your own servers |
| 3306 | MariaDB or MySQL | no (at most for the website server IP) |
| 3389 | Remote Desktop (RDP) | only for your own IPs or over a VPN |
These are typical values; check the login and game server configs of your pack for the exact ports. Inbound allow rules are created in an administrator PowerShell:
New-NetFirewallRule -DisplayName "L2 Login" -Direction Inbound -Protocol TCP -LocalPort 2106 -Action Allow
New-NetFirewallRule -DisplayName "L2 Game" -Direction Inbound -Protocol TCP -LocalPort 7777 -Action AllowThere is no need to disable the built-in Defender antivirus. To keep real-time scanning from slowing down log and database writes, add exclusions for the server folder and the database data folder, and only for files whose origin you trust:
Add-MpPreference -ExclusionPath "D:\L2Server"
Add-MpPreference -ExclusionPath "C:\Program Files\MariaDB 11.4\data"The data folder path depends on the version; check the datadir setting in my.ini. Do not install third-party optimizers or cleaners on the server.
The startup scripts of many packs already restart the server: for example, on exit code 2 (an in-game restart command) the script starts it again. What is left is starting the server after Windows reboots.
Option 1: Task Scheduler. The task starts at system boot, even if nobody is logged in to Windows. In an administrator PowerShell:
$a = New-ScheduledTaskAction -Execute "D:\L2Server\game\StartGameServer.bat" -WorkingDirectory "D:\L2Server\game"
$t = New-ScheduledTaskTrigger -AtStartup
$t.Delay = "PT1M"
$s = New-ScheduledTaskSettingsSet -ExecutionTimeLimit ([TimeSpan]::Zero)
Register-ScheduledTask -TaskName "L2 GameServer" -Action $a -Trigger $t -Settings $s -User "NT AUTHORITY\SYSTEM" -RunLevel HighestCreate a similar task for the login server with its own folder. The Delay gives the database time to start, and a zero ExecutionTimeLimit removes the run time limit; by default Task Scheduler stops tasks after 72 hours. A task running as SYSTEM has no console window; for better isolation create a dedicated user without administrator rights and use it instead of SYSTEM (with the -User and -Password parameters).
Option 2: a Windows service. Wrapper tools such as WinSW or NSSM register a script or a java process as a service that starts automatically and restarts after a crash. Handy when the machine runs several servers.
Option 3: a console window (test server): a shortcut to the script in the Startup folder (shell:startup) plus automatic user logon. Simple, but less reliable.
wf.msc: Inbound Rules > the Remote Desktop group rules > Properties > Scope > Remote IP address. Do this only if your IP is static or you have fallback access to the VPS console.secpol.msc > Account Policies > Account Lockout Policy (for example, 10 attempts and a 15-minute lockout).| Old tip | Why not |
|---|---|
| Turn off Windows Update | the server stays exposed to known vulnerabilities; control the install time instead of disabling updates |
| Disable Task Scheduler | it is needed for autostart, backups and system maintenance |
| Disable Terminal Services | that is Remote Desktop itself; you would lose access to the server |
| Delete the POSIX registry keys, remove the 20% QoS reserve in gpedit | modern Windows has no POSIX subsystem, and the 20% bandwidth reserve is a myth: bandwidth is reserved only for programs that request it |
| Remove Windows Messenger, disable NetMeeting, IMAPI and smart cards | these components do not exist in current versions or do not affect performance |
| Set a fixed 4–6 GB page file and Adjust for best performance | let the system manage the page file size; visual effects make no difference on a server |
Would rather not set it all up yourself? Take a look at our turnkey projects and server packs. A website for the project on Linux is covered in the Ubuntu web server guide, and building the server from source in the Maven and ANT guides.
Published 8 October 2026
We help with the server pack, setup, protection and launch — one-off or on an ongoing basis.
Get L2‑Scripts news by email
And 5% off all studio services while you stay subscribed.
The discount is valid while you are subscribed: when ordering, tell the manager your subscription address on Telegram.
Search
News