scripts lineage2  :::  Server Packs lineage 2 — best scripts for admin servers   :::  Projects lineage Turnkey
l2-scripts.com  Freelance Studio

ArticlesTechnical guides9 min read

Setting Up Windows for a Lineage 2 Game Server

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.

Which Windows to choose

SystemWhen it fits
Windows Server 2022 or 2025a dedicated server or VPS for a live project
Windows 11 Proa home or test server, a small project
Windows 10support 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.

Step 1. Updates, time and network

  1. Install all updates before launch: Settings > Windows Update; on Windows Server you can also use the sconfig tool.
  2. Do not turn updates off; control when they are installed instead. On Windows 11 set active hours so the system does not reboot during peak time. On Windows Server, in the Configure Automatic Updates policy (gpedit.msc, Windows Update section), choose automatic download with notification before install, and install updates during maintenance windows.
  3. Check the time zone and time synchronization: Olympiad, siege and event schedules depend on them. Force a sync with w32tm /resync in an administrator command prompt.
  4. The server needs a permanent IP address: a static one on a VPS or a reserved one on your router for a home server.

Step 2. Power settings

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 off

SCHEME_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).

Step 3. Java and JAVA_HOME

  1. Install JDK 17 or 21 (64-bit), whichever version your pack requires.
  2. Open Win+R > sysdm.cpl > Advanced > Environment Variables and under System variables create JAVA_HOME pointing to the JDK root folder without \bin, for example C:\Program Files\Java\jdk-21.
  3. Add %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.

Server memoryMemory for the login and game servers is set in the pack's startup scripts with -Xms and -Xmx. Leave room for the database and the system: the total -Xmx of all processes should be well below the physical RAM.

Step 4. MariaDB or MySQL database

  1. Install a current LTS release of MariaDB or MySQL 8 with the MSI installer; it registers a service that starts automatically.
  2. Set a strong root password and do not allow remote root logins: in the MariaDB installer leave Enable access from remote machines for root user unticked.
  3. Create a separate database and user for the server instead of using root (run this in the MariaDB/MySQL console or any SQL client):
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.

Old SQL files and strict modeIf an old pack's SQL fails to import with errors like Incorrect integer value or Data too long, the cause is the strict SQL mode of current versions. Fixing the SQL is the proper way, but for a quick start you can add 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.

Step 5. Ports and firewall

Port (TCP)PurposeOpen to the internet
2106login server, client connectionsyes
7777game server, client connectionsyes
9014 (sometimes 9013)game server to login server linkno, only locally or between your own servers
3306MariaDB or MySQLno (at most for the website server IP)
3389Remote 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 Allow
External IP and routerIf the server sits behind a router, forward ports 2106 and 7777 to its local address. Set the external IP or domain in the game server config (depending on the pack, a setting like ExternalHostname or an ipconfig.xml file); otherwise clients will see the server in the list but will not be able to enter it.

Step 6. Antivirus

There 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.

Step 7. Autostart and restart

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 Highest

Create 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.

Do not click inside the console windowIf the server runs in a classic cmd window, turn off QuickEdit Mode in the window properties. Otherwise an accidental click starts a text selection and pauses the output, and the server freezes until you press Esc or Enter.

Step 8. Secure remote access

  • Use long, unique passwords for every account with administrator rights and disable accounts you do not need.
  • Allow RDP only with Network Level Authentication (on by default) and only from your own IP addresses or over a VPN. Changing port 3389 is not a substitute for real protection.
  • To limit RDP to your address, open 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.
  • Lock accounts after failed logins: secpol.msc > Account Policies > Account Lockout Policy (for example, 10 attempts and a 15-minute lockout).
  • Do not run the game server under an administrator account unless the pack requires it.
  • Do not browse the web on the server and do not install unnecessary software.
  • Back up the database and configs regularly and store the copies off the server.

Old tips you should not follow

Old tipWhy not
Turn off Windows Updatethe server stays exposed to known vulnerabilities; control the install time instead of disabling updates
Disable Task Schedulerit is needed for autostart, backups and system maintenance
Disable Terminal Servicesthat is Remote Desktop itself; you would lose access to the server
Delete the POSIX registry keys, remove the 20% QoS reserve in gpeditmodern 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 cardsthese components do not exist in current versions or do not affect performance
Set a fixed 4–6 GB page file and Adjust for best performancelet 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

Read also

Need help with your server?

We help with the server pack, setup, protection and launch — one-off or on an ongoing basis.

L2‑Scripts newsletter

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.