The .env file – all settings

Prefer step-by-step instructions? Open the interactive guide to installation, updates and settings. You will choose a computer or a VPS and get instructions for your installation.

Where it is and how to change it

System File
Windows (launcher) Serwer\linux-port\docker\.env in the server folder
Linux / VPS linux-port/docker/.env in the server folder, e.g. /opt/mt2009plus/linux-port/docker/.env
  • Each line is NAME=value, with no spaces around =. Lines starting with # are comments. An empty value (NAME=) means “default setting”.

After a change you must restart the server:

  • Windows: stop and start the server in the launcher.
  • Linux: from the linux-port/docker folder type docker compose up -d. docker compose restart is not enough – a restart leaves the containers with the old settings.

Server settings (.env) in the advanced panel

Saving is done by the updater service, which starts by itself (M2_UPDATE_AUTOSTART=1). In Yohara it serves only as a settings editor – it downloads and installs nothing; in 2.x it installs updates only if you enable them (M2_UPDATE_APPLY). When it is not running, the page is read-only (except for the switches that the panel changes live: Arezzo, Seon-Hae, Alchemy, Sashes, the teleport map). Manual start on Linux, from the linux-port/docker folder:

M2_UPDATE_WATCH_UPDATES=0 docker compose --profile update up -d updater   # w 2.x wystarczy: docker compose --profile update up -d updater

1. The most important

Setting Default What it does
M2_PUBLIC_ADDRESS empty The address players type in the client. On a VPS: the public IP address or a domain (you can check it with the command curl -4 ifconfig.me). Without it, players log in and then hang on “connecting to the server”. On your own computer leave it empty – the launcher will enter 127.0.0.1.
M2_DB_ROOT_PASSWORD random The database administrator password (root). The installer enters it.
M2_DB_PASSWORD random The password of the database user that the game server uses. You also use it to confirm a world reset in the panel.
M2_DB_USER metin2 The name of that database user. Do not change it.
M2_DB_PUBLISH_PORT 3306 The database port for HeidiSQL / Navicat on this computer (only 127.0.0.1). Change it if you already have another MySQL database on 3306 – Database.

2. Panels and ports

Setting Default What it does
M2_PANEL_PASSWORD empty The password for the panels. If empty, the panel makes up its own on first start (the launcher shows it, and on Linux the panel log does: docker compose logs panel). Changing this line later does not change the password – the panel keeps it in its own file.
M2_PANEL_LOCAL_ONLY empty Empty or 1 – the panel does not ask for a password. 0 – the panel asks for the password from M2_PANEL_PASSWORD. On a VPS set 0 or keep the panels on 127.0.0.1 (below).
M2_PANEL_PUBLIC_PORT 7788 The port of the classic panel. Digits only.
M2_SEBAN_PANEL_PORT 7790 The port of the Seban Panel (the advanced panel).
M2_ITEMSHOP_PUBLIC_PORT 7791 The ItemShop port. The VPS installer exposes the ItemShop to players (the panels stay on 127.0.0.1).
M2_PANEL_BIND_ADDRESS 0.0.0.0 The address on which the panels are visible. 127.0.0.1 = only this computer (you then open the panels through an SSH tunnel). The VPS installer sets 127.0.0.1.
M2_HOST_BIND_ADDRESS 0.0.0.0 The address on which the game ports are visible. 127.0.0.1 = only you, 0.0.0.0 = players from the network too. The COOP button in the launcher sets this by itself.
M2_AUTH_PORT 11000 The login port. Change it only if 11000 is taken – players must then know the new port.
M2_MALL_URL empty The ItemShop address (host:port, without http://) that the game gives to the client. Empty = M2_PUBLIC_ADDRESS and the ItemShop port.
M2_GM_PANEL_URL http://127.0.0.1:7788/ Where the character “Preview” („Podgląd”) from the in-game player window opens (the character card in the classic panel).
M2_SEBAN_PANEL_URL empty The address of the advanced panel that other pages show (e.g. links from the classic panel). Empty = set automatically.
M2_SEBAN_SESSION_SECRET empty The Seban Panel session key. Empty = random.
M2_SEBAN_COLLECTOR_INTERVAL 300 How many seconds between the Seban Panel’s collections of world data (the market, rankings).
M2_PANEL_STATUS_PORTS 11000,13000 The ports the panel uses to check whether the server is alive.
M2_TRUST_PROXY 0 1 – the panel sits behind nginx and should read the visitor’s real address. Only when the panel port is on 127.0.0.1.
M2_LOCAL_ONLY 0 1 – the server is for this computer only; the panel then says outright that nobody from the network can join.
M2_BRAND empty The server name in the panel.
M2_CONTACT_EMAIL empty A contact address on the panel page. Empty = no such line.

3. Bots

Setting Default What it does
PLAYERBOT_AUTOSPAWN_COUNT 350 How many bots play. Split evenly between the three kingdoms, at most 2500. The BOT COUNT („LICZBA BOTÓW”) slider in the launcher sets the same thing. More bots mean more life in the world and a heavier CPU load.
PLAYERBOT_AUTOSPAWN_PER_KINGDOM 0 1 – the number of bots separately for each kingdom (three lines below); PLAYERBOT_AUTOSPAWN_COUNT is then ignored.
PLAYERBOT_AUTOSPAWN_SHINSOO, _CHUNJO, _JINNO 0 How many bots in the given kingdom (0–1500), with PLAYERBOT_AUTOSPAWN_PER_KINGDOM=1.
PLAYERBOT_SPAWN_WINDOW_MINUTES 1 Within how many minutes after startup all the bots enter (1–180). 1 = all at once, a larger number = gradually.
PLAYERBOT_LATE_JOINERS 0 How many additional bots join later, one by one, during the game.
PLAYERBOT_LATE_JOIN_HOURS 24 Over how many hours these later joins are spread (1–168).
PLAYERBOT_MEDAL_DROPPERS 0 How many bots per kingdom are “medal droppers” – they sit in the Monkey Dungeon and collect Horse Medals to sell. 0 = disabled.
PLAYERBOT_MEDAL_DROPPER_LEVEL 25 At what level the medal droppers stop gaining experience (18–120).
M2_PLAYERBOT_KINGDOMS 1 1 – bots in all three kingdoms, 0 – only Chunjo.
M2_PLAYERBOT_WORLD_LAYOUT unified The world layout on the game cores. unified – all kingdoms and the whole front on one core, so the bots of every kingdom keep growing. split – three cores, faster with more than 1500 bots, but the Shinsoo and Jinno bots stop at about level 36.
M2_PLAYERBOT_START_HELD 0 1 – after startup there are no bots in the world until you let them in in the panel (the AI page) or in the launcher. It gives you time to set the rates.
M2_PLAYERBOT_HUMAN_NAMES 1 1 – bots get nicknames that look like player nicknames instead of botXX. 0 – no change of nicknames, restore – restore the old bot… nicknames.
PLAYERBOT_RETIRE_COUNT, PLAYERBOT_RETIRE_BATCH_ID, PLAYERBOT_RETIRE_WINDOW_MINUTES, PLAYERBOT_RETIRE_SHOP_MINUTES 0, 0, 1440, 60 Bot retirement – replacing old bots with new ones. The Seban Panel sets these (Management); do not change them manually.
PLAYERBOT_SEED_STRICT 0 For tests. 1 – abort the startup when the bots in the database do not match the expected ones.
PLAYERBOT_EXPECT_MIN_EXISTING_BOTS 0 For tests. How many bots must already be in the database for the startup to count as good.
PLAYERBOT_ZAKLETY_…, PLAYERBOT_SZC_…, PLAYERBOT_HYDRA_…, PLAYERBOT_SUNGMA_…, PLAYERBOT_COHORT_…, PLAYERBOT_DGRUN_… various How many bots farm EXP at once in the Enchanted Forest, the Time Rifts, Ship Defence and on the Sung Ma maps, and how many dungeon runs the bot parties do. The default values are chosen for a typical server – each line is described in .env.example and on the “Server settings (.env)” („Ustawienia serwera (.env)”) page.

More about bots: Bots: how they work and Bots — settings for the administrator.

4. Channels

Setting Default What it does
M2_PLAYERBOT_CH2 0 The second channel: 1 – enabled. Some of the bots play on CH2; bots set up shops on the channel they play on. The easiest way to enable it is in the launcher (BOT COUNT) or in the panel (Rates) – the ports then set themselves.
M2_PLAYERBOT_CH3, M2_PLAYERBOT_CH4 0 The third and fourth channel (CH3 works only with CH2, CH4 only with CH3). Each takes about 2.5–3 GB more RAM. Panel: Management → Auto Hunt and channels („Autołowy i kanały”).
PLAYERBOT_CH2_SHARE 40 What percentage of bots play outside CH1 (10–90), split evenly across channels 2–4 that have bots.
M2_PLAYERBOT_CH2_SET_AT 0 The moment of the last channel change – do not touch it manually.
M2_CHANNELS 1 How many channels start. Each channel is three game cores and a core with the Yohara maps.
M2_GAME_PORT_RANGE 13000-13003 The game ports on this computer: 13000-13003 is one channel (13003 – the core with the Yohara maps), 13000-13012 two, 13000-13022 three, 13000-13032 four. The Yohara cores of the following channels are 13004–13006. A range that is too narrow (13000-13002) causes a black screen when you enter a Yohara map – the launcher and the VPS installer fix it by themselves.
M2_GAME_CONTAINER_PORT_RANGE 13000-13003 The same on the container side – it must equal M2_GAME_PORT_RANGE.
M2_GAME_PORT_BASE 13000 The first channel port in the container. Change it only for a second copy of the server on the same machine.

When you change the number of channels manually, change both port ranges to the same length. Otherwise the channel will start, but nobody will be able to enter it.

5. World and gameplay

Setting Default What it does
M2_AUTOHUNT 1 Auto Hunt (key K) in this world.
M2_AUTOHUNT_ITEM 0 0 – Auto Hunt for everyone, 1 – only with the Auto Hunt (7 days) or (14 days) item from the ItemShop in your inventory.
M2_BUFFI 1 Buffi – the support shaman (key P). After it is turned off, the seals, names and skills stay.
M2_MLODZI_BOHATEROWIE 1 Weapons for Young Heroes: at levels 1, 10, 20 … 70 the character chooses a weapon of their class for 15 days. Takes effect from the next start.
M2_FLEA_MARKET 1 The Department Store at the General Store Saleswoman in the first village. 0 – the Saleswoman opens an ordinary shop.
M2_ALCHEMY 1 The new Cor Draconis (Metins, bosses, shards at the Alchemist). The panel switches this at once.
M2_SASHES 1 The new sashes from bosses and their chests. The panel switches this at once.
M2_STARTER_CHEST 1 The Apprentice’s Chest for a new player character on first login.
M2_DIFFICULTY easy Difficulty level: easy (no waiting), medium (one third of the original), hard (as in the original) or custom (the hours from the lines below). The panel changes the same thing at once.
M2_BIOLOGIST_WAIT_HOURS 0 With custom: how many hours to wait at the Biologist. Fractions are allowed (0.5 = half an hour).
M2_HORSE_WAIT_HOURS 0 With custom: how many hours to wait at the Stable Boy.
M2_BOOK_WAIT_HOURS 0 With custom: how many hours a player waits between two books of the same skill.
M2_BOT_BOOK_WAIT_HOURS 0 The same for bots.
M2_RATE_EXP, M2_RATE_DROP, M2_RATE_YANG 100 Multipliers for experience, drops and Yang in percent (100 = as in the original). Only at the first start of a new world and after a reset – later you change them in the panel, on the Rates page (Rates and events).
M2_MAX_LEVEL 120 The maximum character level (120 is the most the game can handle).
M2_MOONLIGHT_CHEST_PERMILLE 10 The chance of a Moonlight Treasure Chest from a monster, in permille (10 = 1%), during the event. 0 turns it off.
M2_MOONLIGHT_CHEST_STONE_PERMILLE 300 The same for Metins (300 = 30%).
M2_BLESSING_SCROLL_STONE_PERMILLE 10 The chance of a Blessing Scroll from Metins of level 15 to 99, in permille. 0 turns it off.
M2_DRAGON_COIN_STONE_PERMILLE 3 The chance of a DR Voucher (100) from a Metin, in permille (ItemShop).
M2_DRAGON_COIN_BOSS_PERMILLE 50 The chance of a DR Voucher (100) from a boss, in permille (50 = 5%).
M2_DEFAULT_LANGUAGE pl Yohara only. The server’s default language – the game language for players who have not chosen their own, the language of bots in chat and of the panels and ItemShop: pl, en, de, tr, ro, es, it, fr, pt, cz, hu, gr, ae. The launcher asks about it before the first start (Game languages). Takes effect after a restart.
M2_DEFAULT_GAME_LANGUAGE en The language of item, monster and quest names for a fresh world: pl or en. Read only at installation; later you switch it in the panel.
M2_TZ UTC The time zone, e.g. Europe/Warsaw. It sets the times in logs and in the panel and the bots’ night time. The launcher enters the Windows time zone here, and the VPS installer the machine’s time zone.
M2_KEEP_DEMO_ACCOUNTS 1 At the first start of the database it creates the accounts admin / admin (GM) and test / test. 0 – without them. The VPS installer changes their passwords to random ones.
M2_AREZZO 0 The Arezzo module – the Arezzo maps and dungeons and the costume sets in the ItemShop. The panel switches this at once.
M2_SEONHAE 1 The 6th and 7th bonus at Seon-Hae – on by default. An item handed to Seon-Hae always comes back. The panel switches this at once.
M2_MONSTER_CARDS 1 Monster Cards (0 = disabled from the next login, progress stays in the database).
M2_SPIDER3_ON 1 Spider Dungeon 3.
M2_BALATHOR_ON 1 Balathor's Crypt.
M2_TELEPORT_MAP 0 The teleport map under the TAB key (author: Mur4s): 18 points, free teleport. Switches at once.
M2_SHOP_BIG 0 Bigger offline player shops – two pages (160 slots), like the bots’ shops. Switches at once.
M2_SKILL_HACK 0 The second skill path – a third tab in the skill window with the skills of the class’s second path (including its 9th skill), from a shared pool of points. When turned off, the tab disappears and the levels stay. Bots and Buffi do not get it. Switches at once (also /e m2_skill_hack 1).
M2_BONUS_MODE global (a new Yohara installation from 3.0.11; earlier mt2009) mt2009 – the MT2009 PLUS item bonuses (e.g. Max. HP up to 1500). global – bonuses as on the global server (Max. HP up to 2000, resistances to fire / lightning / wind, EXP chance and double drop), every monster has an element, and alchemy gets the default stone bonuses. Items keep their bonuses. Takes effect after a restart.
M2_MONSTER_HP default The toughness of monsters, bosses and Metins: default, easy (80%) or a percentage from 10 to 300. The panel changes this at once.
M2_MONSTER_ATTACK default The damage dealt by monsters and bosses: default, easy (80%) or a percentage 10–300. “Server configuration” („Konfiguracja serwera”) changes this at once.
M2_PLAYER_ATTACK default The damage dealt to monsters by players and bots: default or a percentage 10–300 (110 = +10%, as in the EMERALD configuration). PvP unchanged.
M2_SERVER_PROFILE empty The profile from “Server configuration” chosen at installation (vps-install.sh --profile). The entry alone changes nothing.
M2_STARTER_KIT default The starter kit of a new character: default (as before), medium (weapon and armour at +5), easy (the whole kit at +9).
M2_EXCHANGE_DUST_CHANCE, M2_EXCHANGE_PARCHMENT_CHANCE, M2_EXCHANGE_MATERIAL_CHANCE 0 With the custom difficulty level: the chance of exchanging Spirit Stones for Magic Dust, books for Parchment and upgrade materials for Crafting Materials (0 = as in the package). Difficulty level.

6. Client to download from the panel

The panel has a “Download game” („Pobierz grę”) button. These settings concern the client that the panel gives to players. On an ordinary server leave them empty – you give players the client yourself (the client and patches from Discord).

Setting Default What it does
M2_CLIENT_URL empty The address from which players download the client.
M2_CLIENT_NAME empty The client file name shown to players.
M2_CLIENT_ADDRESS empty The server address entered into the client. Empty = M2_PUBLIC_ADDRESS.
M2_CLIENT_SERVER_NAME empty The server name in the client’s list.
M2_CLIENT_CHANNELS empty How many channels the client shows. Empty = as many as are really running.
M2_CLIENT_AUTH_PORT empty The login port for the client. Empty = M2_AUTH_PORT.
M2_CLIENT_ARCHIVE_URL, _FALLBACK, _FALLBACK2 empty Where to download the client package to build from (the main and backup addresses).
M2_CLIENT_ARCHIVE_SHA256 empty The checksum of that package.
M2_CLIENT_KEEP_ARCHIVE 1 Keep the downloaded package after building (about 1.4 GB). 0 on a small VPS.
M2_CLIENT_MIN_FREE_MB 7000 How many MB of free disk space there must be to begin.
M2_CLIENT_MIN_VERSION the client version from the latest patch Yohara only (a 2.x server lets in a client of any version). The oldest client version the server lets in. An older client gets the message “Wymagana aktualizacja klienta gry przez Patcher.” (“The game client must be updated through the Patcher.”) – you need to apply the client patches. Do not lower it: an older client lacks the windows and data of the new systems.

7. Updates

This section differs between the two versions. In MT2009 PLUS 2.x the panel checks for new versions on GitHub, and the launcher (CHECK FOR UPDATES – „SPRAWDŹ AKTUALIZACJE”) or update.sh / vps-install.sh update installs them. In the Yohara package automatic updates are turned off – new versions arrive as patches – and you should not change these lines (Updates).

Setting 2.x Yohara What it does
M2_UPDATE_CHECK 1 0 1 – once a day the panel checks GitHub for a new version and shows the changelog. 0 – the panel connects to nothing.
M2_UPDATE_APPLY 0 0 1 – the panel can install an update with a button (2.x on Linux only). On a server accessible to others leave 0.
M2_UPDATE_WATCH_UPDATES empty 0 Whether the updater installs updates. Empty = same as M2_UPDATE_APPLY; 0 – it works only as an .env editor.
M2_UPDATE_AUTOSTART 1 1 The updater starts by itself so that the “Server settings (.env)” („Ustawienia serwera (.env)”) page can save changes. 0 – the page is read-only.
M2_UPDATE_STACK_DIR the server folder the server folder The server folder for the updater. The launcher or the VPS installer enters it.
M2_UPDATE_CACHE_DIR, M2_UPDATE_REPO_DIR, M2_UPDATE_BRANCH /var/cache/m2src, /var/cache/m2src/repo, main as in 2.x The updater’s directories and branch. Do not change.
M2_YOHARA_UPDATES_DEFAULTED – 1 A marker that the Yohara launcher or installer has already set the values above once – do not touch it manually.

8. Browser game (experiment)

Off by default. It requires a separate client that is not in the package.

Setting Default What it does
M2_BROWSER_PLAY 0 1 – turns on the bridge for playing through a browser.
M2_BRIDGE_PORT 7789 The bridge port.
M2_BRIDGE_BIND_ADDRESS 127.0.0.1 The bridge’s listening address.
M2_BRIDGE_HOST_ALIASES empty Additional host names under which the bridge responds.
M2_BRIDGE_TRUST_PROXY 0 1 when the bridge sits behind nginx and should read the player’s real address.
M2_BRIDGE_MAX_CONNECTIONS 200 How many connections at once.
M2_BRIDGE_MAX_PER_IP 8 How many connections from one IP address.
M2_BRIDGE_ORIGINS empty Which sites may connect. Empty = no restrictions.
M2_BROWSER_CACHE_MB 768 How many MB of game data the page keeps in memory.

9. Advanced

You usually leave these lines unchanged.

Setting Default What it does
M2_LOG_KEEP_HOURS 48 How many hours of channel log files (syslog, syserr) to keep. A channel writes 40–120 MB per hour.
M2_LOG_KEEP_DAYS 2 How many days to keep the remaining server logs. Reduce it on a small disk.
M2_DB_LOG_RETENTION_DAYS 3 (2.x: 14) How many days to keep entries in the log database (cleaned daily at about 5:00). 0 = everything. Aggregate statistics in the panel stay.
M2_BACKUP_HOST_DIR ../../backups The folder for database copies made before a world reset.
M2_TEST_SERVER 0 1 – the engine’s test mode (GM commands for everyone). On a server where someone is playing, leave 0.
M2_CORE_DUMPS 0 1 – save memory dumps after a game core crash. Only when hunting a bug; it takes a lot of space.
M2_BIND_IP 0.0.0.0 The listening address of the game cores in the container.
M2_TABLE_POSTFIX empty A suffix for table names in the database. Leave empty.
M2_ADMINPAGE_PASSWORD empty The password of the engine’s administration page (not the panel).
M2_INVENTORY_SLOTS 180 How many inventory slots the panel searches (four pages of 45).
M2_MAX_ITEM_COUNT 255 The largest stack the panel will write into the database.
M2_MALL_SAS_KEY GF9001 The signing key of the ItemShop link. Do not change.
M2_MAKE_JOBS empty How many jobs at once when building the server. Empty = chosen to fit the machine’s memory. Use a smaller number if the build hangs from lack of memory.
M2_STRIP_BINARIES 1 1 – smaller server files, 0 – with symbols for crash analysis.
M2_BASE_IMAGE ubuntu:24.04 The system image on which the server is built.
M2_APT_MIRROR empty The Ubuntu package server used during the build. Empty = the Polish one (fast from Poland). Change it if the build is stuck downloading packages.

10. Do not touch manually

The launcher or installer writes these lines. A manual change may cut the server off from its data.

Setting What it is
M2_COMPOSE_PROJECT_NAME The name of this installation in Docker. After a change Docker will not find the containers or the database.
M2_CONTAINER_PREFIX The prefix of container names (e.g. metin2-game).
M2_PLAYERBOT_KINGDOMS_DEFAULTED, M2_TZ_DEFAULTED, M2_SIDEKICK_DEFAULTED, M2_SEONHAE_DEFAULTED Markers that the launcher or installer has already set the given setting once.
M2_PLAYERBOT_CH2_SET_AT The moment of the last change of the second channel.

You set M2_COMPOSE_PROJECT_NAME and M2_CONTAINER_PREFIX yourself only for a second, separate copy of the server on the same machine – before its first start.

Example: a VPS server for friends

M2_PUBLIC_ADDRESS=203.0.113.10
M2_PANEL_BIND_ADDRESS=127.0.0.1
M2_HOST_BIND_ADDRESS=0.0.0.0
M2_TZ=Europe/Warsaw
M2_DEFAULT_LANGUAGE=pl
M2_DEFAULT_GAME_LANGUAGE=pl
PLAYERBOT_AUTOSPAWN_COUNT=600
M2_DIFFICULTY=medium

Leave the database passwords as the installer entered them. You open the panels through an SSH tunnel (Installation on Linux / VPS).

See also