In this article, we are going to setup a Ragnarok Online Server on Ubuntu 14.04 x64. You can be logged in as root or a user with superuser privileges. It’s safer to set this up as a non-root user with sudo. In this tutorial, we’re going to use the rAthena server files.
If you’re using Windows and you have Ubuntu Server (VPS or Dedicated), you will need the following programs.
You may refer to this guide regarding the installation of Apache, MySQL and PHP.
Run these commands over SSH.
apt-get install php5 phpmyadmin mysql-server mysql-client git make gcc libmysqlclient-dev zlib1g-dev libpcre3-dev
sudo apt-get install php5 phpmyadmin mysql-server mysql-client git make gcc libmysqlclient-dev zlib1g-dev libpcre3-dev
After successfully installing the server requirements, let’s proceed on installing and configuring the server files.
Now, we’re going to get the latest updates of rAthena server files. These are the files required on running a Ragnarok Online server. There are other server files that can be used, like Hercules and eAthena, but in this tutorial, we’re using rAthena. Run the command below to download the files.
git clone https://github.com/rathena/rathena.git ~/rAthena
This will place all the files inside rAthena
of your current directory in terminal.
To update the server files to latest revision, run this command.
cd rAthena
git pull
In this part, we’re configuring MySQL for the database of our server. First, check if your MySQL Server is running.
service mysql status
If its not running, enter this command.
service mysqld start
After running the commands above, open the MySQL console.
mysql -u root -p
You will be asked for your root password. After logging in, type the following commands to create the database for our server.
CREATE DATABASE (your ragnarok database name); — We’ll name it “ragnarok”.
mysql> CREATE DATABASE ragnarok;
Then, create a new user for the Ragnarok DB and log 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";
You can replace localhost with an IP address if you want the user to be able to access your MySQL server remotely.
Create log database for the Ragnarok game logs.
CREATE DATABASE (your log database name) — We’ll name it “log”.
mysql> CREATE DATABASE log;
Set permissions for the user that we created earlier named admin.
mysql> GRANT ALL ON log.* TO admin@localhost;
Restore the required tables in your Ragnarok and log database. Update your password after -p
accordingly.
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
We’re using phpMyAdmin that we installed earlier to access the database. Access phpMyAdmin through your web browser.
Select the ragnarok
database and choose the login
table. We can see that there’s one record in that table. Do not delete/modify it yet. It is used by the server. To create a game account, click the SQL tab while on the login
table to open the query editor. Run the following query.
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@email.com', '99', '0', '0', '0', '0', '0000-00-00 00:00:00', '', '0000-00-00', '9', '', '0', '0', '0');
We have inserted a new user in login table with the following information.
/rathena/conf/groups.conf
and check the id lines. As for now, 99 to make this a GM account for special command usage ingame.)Leave the other values as-is. Congratulations. You have successfully created your account for the game.
First, you must know your server’s IP address. You may already know this since it was already included in the server information of your AKLWEB Host VPS. If you want to check it, type:
ifconfig
Look for the eth0 inet addr:xxx.xxx.xxx.xxx part. xxx.xxx.xxx.xxx will be the IP address of your server. If you have Apache installed, you may access this to check if your web server is running.
In FileZilla, login to your VPS with your server credentials and access the /rAthena/conf
folder.
Edit char_athena.conf
and map_athena.conf
with your preferred text editor.
Edit char_athena.conf
from:
// 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
To:
// 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
Where xxx.xxx.xxx.xxx
is the IP address of your server.
In the inter_athena.txt
file, make these changes:
// 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
In the map_athena.txt
file, make these changes:
// 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
Where xxx.xxx.xxx.xxx
is the IP address of your server.
Open subnet_athena.txt
and set the IP Address.
subnet: 255.0.0.0:x.x.x.x:x.x.x.x
And we’re done configuring the 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
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.
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!