Απαιτήσεις
Εγκατάσταση απαιτούμενων πακέτων
Λήψη των αρχείων διακομιστή
Ρύθμιση MySQL
Δημιουργία λογαριασμού παιχνιδιού
Διαμόρφωση των αρχείων διακομιστή
Μεταγλώττιση διακομιστή rAthena
Διαμόρφωση της έκδοσης πακέτου για συνδέσεις πελατών
Εκκίνηση του διακομιστή
βιβλιογραφικές αναφορές
Σε αυτό το άρθρο, πρόκειται να ρυθμίσουμε έναν διαδικτυακό διακομιστή Ragnarok στο Ubuntu 14.04 x64. Μπορείτε να συνδεθείτε ως χρήστης root ή χρήστης με δικαιώματα υπερχρήστη. Είναι πιο ασφαλές να το ρυθμίσετε ως χρήστης χωρίς root με το sudo. Σε αυτό το σεμινάριο, θα χρησιμοποιήσουμε τα αρχεία διακομιστή rAthena.
Εάν χρησιμοποιείτε Windows και διαθέτετε διακομιστή Ubuntu (VPS ή Dedicated), θα χρειαστείτε τα ακόλουθα προγράμματα.
- FileZilla
- Στόκος
- Πρόγραμμα επεξεργασίας κειμένου (συνιστάται Sublime ή Notepad++)
Απαιτήσεις
- apache2 - Εάν σκοπεύετε να χρησιμοποιήσετε το phpMyAdmin για απομακρυσμένη πρόσβαση στο mysql και τη ρύθμιση του ιστότοπού σας.
- php5 - Για web και phpMyAdmin.
- phpmyadmin - Απομακρυσμένη πρόσβαση MySQL χρησιμοποιώντας πρόγραμμα περιήγησης ιστού.
- mysql-server - η βάση δεδομένων μας για τον διακομιστή παιχνιδιών.
- mysql-client
- git
- φτιαχνω, κανω
- gcc
- libmysqlclient-dev
- zlib1g-dev
- libpcre3-dev - Προαιρετικό, για υποστήριξη PCRE.
- libssl-dev - Απαιτείται, για μεταγλώττιση με MySQL 5.5.
Μπορείτε να ανατρέξετε σε αυτόν τον οδηγό σχετικά με την εγκατάσταση των Apache, MySQL και PHP.
Εγκατάσταση απαιτούμενων πακέτων
Εκτελέστε αυτές τις εντολές μέσω SSH.
Χρήστης ρίζας:
apt-get install php5 phpmyadmin mysql-server mysql-client git make gcc libmysqlclient-dev zlib1g-dev libpcre3-dev
Non-root με δικαιώματα sudo:
sudo apt-get install php5 phpmyadmin mysql-server mysql-client git make gcc libmysqlclient-dev zlib1g-dev libpcre3-dev
Μετά την επιτυχή εγκατάσταση των απαιτήσεων διακομιστή, ας προχωρήσουμε στην εγκατάσταση και τη διαμόρφωση των αρχείων διακομιστή.
Λήψη των αρχείων διακομιστή
Τώρα, θα λάβουμε τις πιο πρόσφατες ενημερώσεις των αρχείων διακομιστή rAthena. Αυτά είναι τα αρχεία που απαιτούνται για την εκτέλεση ενός διακομιστή Ragnarok Online. Υπάρχουν άλλα αρχεία διακομιστή που μπορούν να χρησιμοποιηθούν, όπως το Hercules και το eAthena, αλλά σε αυτό το σεμινάριο, χρησιμοποιούμε το rAthena. Εκτελέστε την παρακάτω εντολή για λήψη των αρχείων.
git clone https://github.com/rathena/rathena.git ~/rAthena
Αυτό θα τοποθετήσει όλα τα αρχεία μέσα rAthena
στον τρέχοντα κατάλογο σας στο τερματικό.
Για να ενημερώσετε τα αρχεία διακομιστή στην πιο πρόσφατη αναθεώρηση, εκτελέστε αυτήν την εντολή.
cd rAthena
git pull
Ρύθμιση MySQL
Σε αυτό το μέρος, διαμορφώνουμε τη MySQL για τη βάση δεδομένων του διακομιστή μας. Πρώτα, ελέγξτε εάν ο MySQL Server σας εκτελείται.
service mysql status
Εάν δεν εκτελείται, πληκτρολογήστε αυτήν την εντολή.
service mysqld start
Αφού εκτελέσετε τις παραπάνω εντολές, ανοίξτε την κονσόλα MySQL.
mysql -u root -p
Θα σας ζητηθεί ο κωδικός πρόσβασης root. Αφού συνδεθείτε, πληκτρολογήστε τις παρακάτω εντολές για να δημιουργήσετε τη βάση δεδομένων για τον διακομιστή μας.
CREATE DATABASE (your ragnarok database name); -- We'll name it "ragnarok".
mysql> CREATE DATABASE ragnarok;
Στη συνέχεια, δημιουργήστε έναν νέο χρήστη για το Ragnarok DB και καταγράψτε το DB.
GRANT ALL ON ragnarok.* TO yourdatabaseusername@localhost IDENTIFIED BY "yourdesiredpassword"; -- We will create a new user called admin with a password of 123456.
mysql> GRANT ALL ON ragnarok.* TO admin@localhost IDENTIFIED BY "123456";
Μπορείτε να αντικαταστήσετε τον localhost με μια διεύθυνση IP, εάν θέλετε ο χρήστης να μπορεί να έχει πρόσβαση στον διακομιστή MySQL από απόσταση.
Δημιουργήστε βάση δεδομένων αρχείων καταγραφής για τα αρχεία καταγραφής παιχνιδιών Ragnarok.
CREATE DATABASE (your log database name) -- We'll name it "log".
mysql> CREATE DATABASE log;
Ορίστε δικαιώματα για τον χρήστη που δημιουργήσαμε νωρίτερα με το όνομα διαχειριστής .
mysql> GRANT ALL ON log.* TO admin@localhost;
Επαναφέρετε τους απαιτούμενους πίνακες στη βάση δεδομένων Ragnarok και καταγραφής. Ενημερώστε τον κωδικό πρόσβασής σας μετά -p
ανάλογα.
mysql> quit;
mysql -u admin -p123456 ragnarok < /path/to/your/rathena folder/sql-files/main.sql
mysql -u admin -p123456 log < /path/to/your/rathena folder/sql-files/logs.sql
Δημιουργία λογαριασμού παιχνιδιού
Χρησιμοποιούμε το phpMyAdmin που εγκαταστήσαμε νωρίτερα για πρόσβαση στη βάση δεδομένων. Αποκτήστε πρόσβαση στο phpMyAdmin μέσω του προγράμματος περιήγησής σας.
Επιλέξτε τη ragnarok
βάση δεδομένων και επιλέξτε τον login
πίνακα. Μπορούμε να δούμε ότι υπάρχει ένα ρεκόρ σε αυτόν τον πίνακα. Μην το διαγράψετε/τροποποιήσετε ακόμα. Χρησιμοποιείται από τον διακομιστή. Για να δημιουργήσετε έναν λογαριασμό παιχνιδιού, κάντε κλικ στην καρτέλα SQL ενώ βρίσκεστε στον login
πίνακα για να ανοίξετε το πρόγραμμα επεξεργασίας ερωτημάτων. Εκτελέστε το ακόλουθο ερώτημα.
INSERT INTO `ragnarok`.`login` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `group_id`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`, `character_slots`, `pincode`, `pincode_change`, `vip_time`, `old_group`) VALUES ('2000000', 'admin', 'password123', 'M', '[email protected]', '99', '0', '0', '0', '0', '0000-00-00 00:00:00', '', '0000-00-00', '9', '', '0', '0', '0');
Έχουμε εισαγάγει έναν νέο χρήστη στον πίνακα σύνδεσης με τις ακόλουθες πληροφορίες.
- account_id = 2000000 (Να ξεκινάτε πάντα με 2000000 και μετά 2000001...)
- userid = διαχειριστής (Το όνομα χρήστη σας στο παιχνίδι)
- user_pass = password123 (Ο κωδικός πρόσβασης για τον λογαριασμό σας)
- φύλο = M (M ή F, μην χρησιμοποιείτε το S γιατί είναι μόνο για τον διακομιστή)
- email = [email protected] (Το email του λογαριασμού σας, που χρησιμοποιείται για τη διαγραφή υποδοχών χαρακτήρων στο παιχνίδι)
- group_id = 99 (ανατρέξτε
/rathena/conf/groups.conf
και ελέγξτε τις γραμμές αναγνωριστικού. Προς το παρόν, το 99 για να γίνει αυτό λογαριασμός GM για χρήση ειδικών εντολών στο παιχνίδι.)
- character_slots = 9 (αριθμός χαρακτήρων που μπορούν να δημιουργηθούν ανά λογαριασμό)
Αφήστε τις άλλες τιμές ως έχουν. Συγχαρητήρια. Έχετε δημιουργήσει με επιτυχία τον λογαριασμό σας για το παιχνίδι.
Διαμόρφωση των αρχείων διακομιστή
Αρχικά, πρέπει να γνωρίζετε τη διεύθυνση IP του διακομιστή σας. Ίσως το γνωρίζετε ήδη, καθώς περιλαμβανόταν ήδη στις πληροφορίες διακομιστή του Vultr VPS σας. Αν θέλετε να το ελέγξετε, πληκτρολογήστε:
ifconfig
Αναζητήστε το τμήμα eth0 inet addr:xxx.xxx.xxx.xxx . xxx.xxx.xxx.xxx θα είναι η διεύθυνση IP του διακομιστή σας. Εάν έχετε εγκατεστημένο το Apache, μπορείτε να αποκτήσετε πρόσβαση σε αυτό για να ελέγξετε εάν ο διακομιστής ιστού σας εκτελείται.
Στο FileZilla, συνδεθείτε στο VPS σας με τα διαπιστευτήρια του διακομιστή σας και αποκτήστε πρόσβαση στον /rAthena/conf
φάκελο.
Επεξεργαστείτε char_athena.conf
και map_athena.conf
με το πρόγραμμα επεξεργασίας κειμένου που προτιμάτε.
Επεξεργασία char_athena.conf
από:
// Login Server IP
// The character server connects to the login server using this IP address.
// NOTE: This is useful when you are running behind a firewall or are on
// a machine with multiple interfaces.
//login_ip: 127.0.0.1
// The character server listens on the interface with this IP address.
// NOTE: This allows you to run multiple servers on multiple interfaces
// while using the same ports for each server.
//bind_ip: 127.0.0.1
// Login Server Port
login_port: 6900
// Character Server IP
// The IP address which clients will use to connect.
// Set this to what your server's public IP address is.
//char_ip: 127.0.0.1
Προς το:
// Login Server IP
// The character server connects to the login server using this IP address.
// NOTE: This is useful when you are running behind a firewall or are on
// a machine with multiple interfaces.
login_ip: xxx.xxx.xxx.xxx
// The character server listens on the interface with this IP address.
// NOTE: This allows you to run multiple servers on multiple interfaces
// while using the same ports for each server.
//bind_ip: 127.0.0.1
// Login Server Port
login_port: 6900
// Character Server IP
// The IP address which clients will use to connect.
// Set this to what your server's public IP address is.
char_ip: xxx.xxx.xxx.xxx
Πού xxx.xxx.xxx.xxx
είναι η διεύθυνση IP του διακομιστή σας.
Στο inter_athena.txt
αρχείο, κάντε αυτές τις αλλαγές:
// Global SQL settings
// overridden by local settings when the hostname is defined there
// (currently only the login-server reads/obeys these settings)
// MySQL Login server
login_server_ip: 127.0.0.1 // <- either 127.0.0.1 or your server's ip, we'll use 127.0.0.1 since it listens to own mySQL server, change it to IP if your mySQL Server is in different server.
login_server_port: 3306
login_server_id: ragnarok // <- change this to your mySQL User your created earlier
login_server_pw: ragnarok // <- its password
login_server_db: ragnarok // <- change this if your ragnarok db you set is different
login_codepage:
login_case_sensitive: no
ipban_db_ip: 127.0.0.1 // <- either 127.0.0.1 or your server's ip, we'll use 127.0.0.1 since it listens to own mySQL server, change it to IP if your mySQL Server is in different server.
ipban_db_port: 3306
ipban_db_id: ragnarok // <- change this to your mySQL User your created earlier
ipban_db_pw: ragnarok // <- its password
ipban_db_db: ragnarok // <- change this if your ragnarok db you set is different
ipban_codepage:
// MySQL Character server
char_server_ip: 127.0.0.1 // <- either 127.0.0.1 or your server's ip, we'll use 127.0.0.1 since it listens to own mySQL server, change it to IP if your mySQL Server is in different server.
char_server_port: 3306
char_server_id: ragnarok // <- change this to your mySQL User your created earlier
char_server_pw: ragnarok // <- its password
char_server_db: ragnarok // <- change this if your ragnarok db you set is different
// MySQL Map Server
map_server_ip: 127.0.0.1 // <- either 127.0.0.1 or your server's ip, we'll use 127.0.0.1 since it listens to own mySQL server, change it to IP if your mySQL Server is in different server.
map_server_port: 3306
map_server_id: ragnarok // <- change this to your mySQL User your created earlier
map_server_pw: ragnarok // <- its password
map_server_db: ragnarok // <- change this if your ragnarok db you set is different
// MySQL Log Database
log_db_ip: 127.0.0.1 // <- either 127.0.0.1 or your server's ip, we'll use 127.0.0.1 since it listens to own mySQL server, change it to IP if your mySQL Server is in different server.
log_db_port: 3306
log_db_id: ragnarok // <- change this to your mySQL User your created earlier
log_db_pw: ragnarok // <- its password
log_db_db: log // <- change this if your log db you set is different
log_codepage:
log_login_db: loginlog
Στο map_athena.txt
αρχείο, κάντε αυτές τις αλλαγές:
// Character Server IP
// The map server connects to the character server using this IP address.
// NOTE: This is useful when you are running behind a firewall or are on
// a machine with multiple interfaces.
char_ip: x.x.x.x
// The map server listens on the interface with this IP address.
// NOTE: This allows you to run multiple servers on multiple interfaces
// while using the same ports for each server.
//bind_ip: 127.0.0.1
// Character Server Port
char_port: 6121
// Map Server IP
// The IP address which clients will use to connect.
// Set this to what your server's public IP address is.
map_ip: x.x.x.x
// Map Server Port
map_port: 5121
Πού xxx.xxx.xxx.xxx
είναι η διεύθυνση IP του διακομιστή σας.
Ανοίξτε subnet_athena.txt
και ορίστε τη διεύθυνση IP.
subnet: 255.0.0.0:x.x.x.x:x.x.x.x
Και τελειώσαμε τη διαμόρφωση του διακομιστή.
Compiling rAthena server
Now, time to compile the server! In this part, you need to know what Ragnarok Online client version you'll be using to connect to the server. For client setup, visit this page.
After you decide which client to be use, let's edit some files. Let's just say, we chose to use the 08072013
client since this is the stable renewal client.
Run this command on terminal:
./configure --enable-packetver=YYYYMMDD
Replace YYYYMMDD
with the client date (reformatted).
./configure --enable-packetver=20130807
The configure script will perform necessary tests and generate makefiles for our server.
After that, compile the source code by entering these commands:
make server
chmod a+x login-server && chmod a+x char-server && chmod a+x map-server
... and wait for it to finish. If you make modifications on the files inside /rAthena/src
folder, you will need to recompile it.
make clean
make server
Configuring the packet version for client connections
In FileZilla, point to the /rAthena/db
folder and edit packet_db.txt
.
Find this line and edit:
//
//packet_db_ver: 46
packet_db_ver: default
packet_keys_use: default
Since we're using the 2013-08-07Ragexe
client, find the specified client below and look for its packet_ver and packet_keys.
//2013-08-07Ragexe
packet_ver: 45
packet_keys: 0x7E241DE0,0x5E805580,0x3D807D80 // [Shakto]
Replace the default value of packet_db_ver
and packet_keys_use
into the specified client values.
//
//packet_db_ver: 46
packet_db_ver: 45
packet_keys_use: 0x7E241DE0,0x5E805580,0x3D807D80
And save. This is for specifying what client is to be used by players. We don't want them to be able to use their version of choice.
Starting the server
After compiling the server files, use these commands to fire up the server.
To start:
./athena-start start
To stop:
./athena-start stop
To restart:
./athena-start restart
If you have encountered an error like this:
-bash: ./athena-start: /bin/sh^M: bad interpreter
... then you need to install dos2unix to convert the script.
apt-get install dos2unix
dos2unix athena-start
chmod a+x athena-start
After running those commands, start the server again.
Now that we're done with the server setup, you just need to set your Ragnarok client to point to your VPS server. Enjoy playing on your new server!
References