aslain.dev
0%
← Tüm makaleler

Metin2 Server Files Setup: Step by Step From Scratch

A Metin2 server files setup is the first and most critical step that turns an empty VPS into a working game server. In this guide I walk through, from scratch, how to upload the files to the server, set the correct permissions, import the MySQL databases, configure CONFIG and my.cnf, and start the db and game (core) processes for the first time. Because most classic server files packages ship with binaries compiled for FreeBSD, my examples follow a FreeBSD-based installation.

Requirements and choosing the right operating system

Before you begin, make sure you have:

  • A VPS with root access (older server files usually require FreeBSD and 32-bit binaries; pick the version your files demand).
  • An SSH and SFTP client: PuTTY + WinSCP or FileZilla.
  • A MySQL/MariaDB server (usually bundled with the pack, or installed via ports).
  • A database client: HeidiSQL or Navicat.
  • The server files archive (typically a .tar.gz) and the matching client.

The most common mistake is using an OS architecture that is incompatible with the binaries. You cannot run a game binary compiled for FreeBSD on Linux; matching the architecture and version is mandatory.

Uploading the files to the server

Uploading the archive directly to the server is far faster than transferring each file individually over SFTP. Connect via SSH and extract the archive into the target directory:

cd /usr/home
mkdir -p metin2 && cd metin2
# Upload the archive into this directory with WinSCP/FileZilla, then:
tar -xzvf serverfiles.tar.gz

A typical directory layout looks like this:

  • /usr/home/metin2/db/ — database core (db core), conf.txt
  • /usr/home/metin2/game/ — game core, channel folders (channel1, channel2...)
  • /usr/home/metin2/share/ — shared data (proto, mob, item)

When the upload finishes, don't forget to fix file ownership; if you extracted as root, hand it over to the user that will run the server:

chown -R metin2:metin2 /usr/home/metin2

Importing the MySQL databases

Metin2 uses several databases. The most common schema consists of these four:

  • account — accounts and login data
  • player — characters, items, quests, guild data
  • common — banned words, GM list, settings
  • log — in-game logs

First create the empty databases, then import the .sql dumps. From the command line:

mysql -u root -p -e "CREATE DATABASE account; CREATE DATABASE player; CREATE DATABASE common; CREATE DATABASE log;"
mysql -u root -p account < account.sql
mysql -u root -p player  < player.sql
mysql -u root -p common  < common.sql
mysql -u root -p log     < log.sql

If you'd rather not deal with the command line, open an SSH tunnel with HeidiSQL or Navicat and import each .sql file into the matching database via "Run SQL File / Execute". After importing, remember to add your own account as a GM in the common.gmlist table; otherwise you won't have access to in-game commands.

To create a test account, insert a row into account.account. Most server files store the password using the password() function:

INSERT INTO account.account (login, password, social_id, email)
VALUES ('test', password('1234'), '1111111', 'test@local');

Configuring conf.txt, CONFIG and my.cnf

Without correct network settings the client cannot connect to the server. Three files are critical.

db/conf.txt — defines how the db core connects to MySQL. Edit the username, password and database names to match your setup:

SQL_ACCOUNT: localhost  account  root  PASSWORD
SQL_PLAYER:  localhost  player   root  PASSWORD
SQL_COMMON:  localhost  common   root  PASSWORD
SQL_HOTBACKUP: localhost log     root  PASSWORD
PLAYER_SQL_DIRECT: 1

game/<channel>/CONFIG — holds each channel's IP, port and channel number. Set BIND_IP to the VPS's public IP address; if you leave it as 127.0.0.1, nobody can connect from outside:

HOSTNAME: ch1
CHANNEL: 1
BIND_IP: 11.22.33.44
PORT: 13001
P2P_PORT: 14001
DB_ADDR: 127.0.0.1
DB_PORT: 15000

my.cnf — MySQL's listen address and performance settings. If the database is local, leave bind-address = 127.0.0.1; on small VPS instances keep innodb_buffer_pool_size reasonable relative to your RAM. Also make sure that the IP/port in the client's serverinfo.py exactly matches the server's CONFIG.

Permissions and first boot

The binaries won't start unless they are executable. Grant execute permission to the db and game binaries:

cd /usr/home/metin2
chmod +x db/db
chmod +x game/channel1/game
# and any start scripts:
chmod +x *.sh

The start order matters: db core first, then game core. The game core cannot connect until the db core has opened its MySQL connection and started listening on its port.

# 1) start the db core
cd /usr/home/metin2/db
./db &

# 2) wait a few seconds, then start the game core
cd /usr/home/metin2/game/channel1
./game &

To watch the output, follow the tail -f syserr and tail -f syslog files. Verify the processes are actually up with ps aux | grep -E 'db|game' and check listening ports with sockstat -4 -l. At this point you can point your client at the server IP and log in with the test account.

Frequently Asked Questions

The server starts but the client can't connect — why?

It's almost always a networking setting. BIND_IP in CONFIG may still be 127.0.0.1, the client's serverinfo.py may point to the wrong IP/port, or the firewall is blocking ports like 13001/15000. Confirm the ports are actually being listened on with sockstat -4 -l on the server.

The db core throws a "can't connect to MySQL" error.

The username, password or database names in db/conf.txt are wrong. Try connecting manually with mysql -u root -p account; if that fails, the problem is not the core but the MySQL user or its privileges.

Will FreeBSD server files run on my Linux VPS?

No. Binaries compiled for FreeBSD won't run directly on a Linux kernel. Either install the FreeBSD version the files require, or use a pack compiled for Linux; matching architecture and version is mandatory.

Stuck during installation? I've worked for years on Metin2 server files setup, quest/Lua editing and VPS optimization. To bring your server up from scratch or harden an existing install, get in touch with me.

Devamı için