Jump to content
  • 0

[Guide]: Compiling and Setting Up rAthena Server using Linux Distro on Windows Platform via Vagrant


aszrool

Question


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   8
  • Joined:  01/02/14
  • Last Seen:  

Introduction

Vagrant has been widely used for running the Linux distribution environments on top of Windows platform for the sake of consistency on development setup among developers since they can share the exact Linux distro setting within their team. Vagrant helps the developer to automate the process of setup the particular environment such as LAMP and it can be deployed into production server later which reduce the time of manually setup instead of focusing on developing the system. Vagrant also helps reduces "meddling" the host system files since vagrant contained the intended setup inside guest system. So every time the developer format his/her computer or buying new PC/Workstation/Laptop, he/she can quickly restore his/her development environment inside the new computer.

Some of you might want to use gcc/g++ compiler instead of Microsoft Visual Studio or Cygwin or you might want to practice setting up the server locally before deploying it into VPS/Dedicated server etc. So this guide suits your needs. In this guide, I will show you how to use Laravel Homestead box for compiling rAthena.

**NOTES** You can use any vagrant boxes as well although in this case, I am using Homestead because it came together with LAMP preconfigured and I am still developing custom vagrantfile and in the future, I might release rAthena boxes for speeding up the process. For the time being just bear with this one. :P
 

Preliminary

Download these files first

  1. Virtual Box: https://www.virtualbox.org/wiki/Downloads
  2. Vagrant: https://www.vagrantup.com/downloads.html
  3. Cmder: http://cmder.net **Preferably choose "Download full" 
  4. MySQL Workbench: https://dev.mysql.com/downloads/workbench/
  5. Atom/Notepad++/Any your preferred editor: https://atom.io / https://notepad-plus-plus.org

Installing Virtual Box, Vagrant, MySQL Workbench and those editor should be self-explanatory. Just keep clicking "Yes" and "Finish". However, for cmder, you can extract it into any place you want as shown below:

C:\cmder

Create the shortcut of Cmder.exe from inside cmder folder and paste it into your desktop for the sake of easy access.

Configure Vagrant

1. Run your Cmder.exe shortcut and install Vagrant plugins for VirtualBox Guest Additions using below command.

vagrant plugin install vagrant-vbguest

2. Generate ssh key using below command.

ssh-keygen -t rsa

3. It will show these lines, just press enter to accept the path to store your ssh key.

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/YOUR_USERNAME/.ssh/id_rsa):

4. Enter your any passphrase key and insert the same key for the second one.

Created directory '/c/Users/YOUR_USERNAME/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

 

Configure Laravel Homestead

1. Download the Laravel Homestead box using below command and choose virtualbox as provider. Wait until it finish downloading. Its gonna take a while depending on your internet connection speed.

vagrant box add laravel/homestead

2. It is preferably to change into another disk for your homestead folder. Example as show below.

C:\Users\Zarey
λ cd ..

C:\Users
λ cd ..

C:\
λ D:

D:\
λ mkdir homesteads

D:\
λ cd homesteads

3. Clone the homestead repository into your preferable folder like shown previously.

D:\homesteads
λ git clone https://github.com/laravel/homestead.git rAthenaHomesteads

4. Enter rAthenaHomesteads folder and run following command.

D:\homesteads
λ cd rAthenaHomesteads

D:\homesteads\rAthenaHomesteads (master)
λ bash init.sh

5. Open the generated Homestead.yaml inside rAthenaHomesteads folder using your favorite editor. Use below setting as your guidance. As you can see, I create SourceCodes folder inside my drive E which is the place I keep rAthena server. Customize it according to your needs. Don't forget to save your changes. You can also refer this official documentations for Laravel Homestead.

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: c:/Users/YOUR_USERNAME/.ssh/id_rsa.pub

keys:
    - c:/Users/YOUR_USERNAME/.ssh/id_rsa

folders:
    - map: e:/SourceCodes
      to: /home/vagrant/Codes

sites:
    - map: homestead.app
      to: /home/vagrant/Codes/WebDevs/blog/public

databases:
    - homestead

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

6. It is time to run your homestead box. Inside your rAthenaHomestead folder, run the below command to start the homestead box. Its gonna take a while and you can ignore the warning about insecure key.

vagrant up

7. Now you can enter the homestead box via ssh using below command.

vagrant ssh

 

Compile rAthena server

1. At this point, you can refer rAthena wiki for the compiling process. However, I am gonna show the step that I used for this guide. Since you already inside the homestead box for the first time, it is recommended to update and upgrade your homestead box. Choose the option "keep the installed ..." every time it popup when upgrading the homestead box. So that the preconfigured settings inside homestead box are keep intact unless you know what you are doing. Use below commands to update and upgrade your homestead box.

sudo apt update
sudo apt upgrade

2. Exit from your homestead and restart your homestead box before you enter again using below commands. Its gonna take a while.

exit
vagrant halt
vagrant up
vagrant ssh

3. Install the following packages using below command. Although some packages might already installed, it is no harm to use below command just to avoid the missing packages.

sudo apt install git make gcc g++ libmysqlclient-dev zlib1g-dev libpcre3-dev

4. Go to Codes folder and clone the rAthena repository. **NOTES** You might wondering why I didn't clone the repo first before enter the homestead box? It is because I want to avoid using dos2unix whenever some bad interpreter occurred. 

vagrant@homestead:~$ cd Codes
vagrant@homestead:~/Codes$ git clone https://github.com/rathena/rathena.git

5. Go to rathena folder and compile it accordingly.

vagrant@homestead:~/Codes$ cd rathena
vagrant@homestead:~/Codes/rathena$ ./configure && make clean && make server

 

Setup rAthena configuration

1. Configure the rAthena networking & anything you need inside conf folder. Please note the IP address for your rAthena is based on what you set inside Homestead.yaml, in this case it would be 196.168.10.10. Below are my examples.

- conf/import/char_conf.txt

userid: serv1
passwd: perv1
login_ip: 192.168.10.10
char_ip: 192.168.10.10
start_zeny: 500

- conf/import/inter_conf.txt

// MySQL Login server
login_server_ip: 127.0.0.1
login_server_port: 3306
login_server_id: root
login_server_pw: secret
login_server_db: rathena
login_codepage:
login_case_sensitive: no

ipban_db_ip: 127.0.0.1
ipban_db_port: 3306
ipban_db_id: root
ipban_db_pw: secret
ipban_db_db: rathena
ipban_codepage:

// MySQL Character server
char_server_ip: 127.0.0.1
char_server_port: 3306
char_server_id: root
char_server_pw: secret
char_server_db: rathena

// MySQL Map Server
map_server_ip: 127.0.0.1
map_server_port: 3306
map_server_id: root
map_server_pw: secret
map_server_db: rathena

// MySQL Log Database
log_db_ip: 127.0.0.1
log_db_port: 3306
log_db_id: root
log_db_pw: secret
log_db_db: rathena
log_codepage:
log_login_db: loginlog

- conf/import/map_conf.txt

userid: serv1
passwd: perv1
char_ip: 192.168.10.10
map_ip: 192.168.10.10

*** NOTES *** It is not recommended to use root account to access the database, please create the specific account for your server if possible. Above is just for the example.

 

Setup rAthena database via MySQL Workbench

Although you may use the command line method provided by rAthena wiki, if you like to use GUI method via MySQL Workbench, here are the steps you may follow.

*** NOTES *** Below examples are using root account for database. Please create new account accordingly. You can find the option to create new account on Server > Users and Privileges menu which you can only access via root account.

1. Open the MySQL Workbench from Start > All Programs > MySQL > MySQL Workbench 6.3 CE

2. Click the "+" sign on the right of "MySQL Connections" and fill the form as shown below.

0.png.784a87fef8778b49985e5b5aeecd58e2.png

3. Click "Test Connection" button, and enter the "secret" for password. If there is "Can't connect error appear" try click "Ok" and the popup asking password should be appeared.

0-1.png.7ad435fc82f94f7779e42cf91bc177dd.png

4. Click the "Vagrant" to access the database connection

0-4.png.b65e6f6489b758e3c3086e389733e3d0.png

5. Right click and select "Create Schema

1.png.6d0dbdab71c6d3da580d146c6f8f6308.png

6. Type "rathena" for the name or any name for your database and click "Apply"

2.png.3e7682ef8642ad252ab7a71a7ff0021a.png

7. Click "Apply" and "Finish" after that.

8. Double click the rathena on schemas to select it. 

5.png.ea2ad36229897bdbfd5e711c33c5520c.png

9. Use "Ctrl+Shift+O" to select the sql files from your rAthena server folder.

6.png.43af044c0924df4e39f50d8983b3ab7c.png

10. Use "Ctrl+Shift+Enter" to execute the sql files that you just opened. Repeat all 9-10 steps for all sql files.

11. Right click on schemas and select "Refresh All" to see all loaded tables inside your database.

12. Right click on login table to edit the appropriate details. Based on previous steps, I change the s1 & p1 into serv1 & perv1. You can insert new row for your new account as well. Don't forget to click "Apply" button to save the changes you just made inside the table. Then click "Apply" & "Finish" whenever the pop windows appeared.

At this point, you may follow other people guides for setting up the client side. Use below command to run the rAthena server.

./athena-start start

 

Good luck!

*** NOTES *** 

Homestead SSH access username is "vagrant@IP_Address" (my example would be "[email protected]" and password is "vagrant"

Homestead database username is "vagrant" and password is "secret"

 

Credits, Resources & References

rAthena Github & Wikis: https://github.com/rathena/rathena & https://github.com/rathena/rathena/wiki

Laravel Homestead Official Docs: https://laravel.com/docs/5.4/homestead

Tutorial to connect vagrant database with MySQL Workbench via ssh: https://ttmm.io/tech/vagrant-windows/

Another Laravel Homestead on Windows 10 tutorial: https://medium.com/@eaimanshoshi/i-am-going-to-write-down-step-by-step-procedure-to-setup-homestead-for-laravel-5-2-17491a423aa

  • Upvote 2
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   8
  • Joined:  01/02/14
  • Last Seen:  

On 7/20/2017 at 11:01 AM, tathanngudong said:

So hard...

Which parts that make it so hard?

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

@MrBlex how much the disk space required for this installation?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   8
  • Joined:  01/02/14
  • Last Seen:  

Hi @Cydh, sorry for a very late reply, 6GB+ should be enough for this installation (approximately 3GB just to be safe) + the RO client files (3GB+) although the more is better. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...