[TUTORIAL] Setting up a Shaiya Virtual Test Server

12/13/2010 06:38 abrasive#1
Warning - this guide is really really long, because it contains tons of screen shots.

I started this guide as a future reference to help myself set up Shaiya private servers in the future. It evolved into a full-fledged tutorial however.

You may ask why you would want a Shaiya test server in a virtual machine?
This allows you to isolate an entire Shaiya server to a single file, literally. This gives you many options.
Some examples:
Got a new developer staff member and want to get them developing quickly? Give them a copy of your virtual test server.
Want to make some major changes to the test server, but afraid you will break everything? Make a clone of the virtual test server and try it on that.
Want to reinstall Windows, but not set up another Shaiya server? You can move the virtual test server to separate media while you complete the reinstall.
Want to test out a different episode and/or database? Make a clone of the virtual test server and go to town.
Etc, etc..
This guide assumes you have accomplished quite a few things beforehand:
You can install Windows XP on your own, as well as provide the necessary media to do so. This is not a guide on installing Windows XP.
You already have or know where to get Shaiya private server files. There are a few places to get these, whether they are ep3, ep4, ep5, etc.
You have successfuly set up a Shaiya server in the past, and already have known working database and server files to use. This is not a guide for setting up a Shaiya private server, although it does cover quite a few aspects of that.
You currently have a router running dhcp, or a dhcp server on your local network that is able to give your virtual machine an IP address. There are other ways to do this, but for the sake of simplicity I chose only to assume this one method in this guide. This is not a guide covering the basics of networking.
Most importantly, you understand that this guide was not created with security in mind and should never be used as a public server. It is meant for testing use only. This is not a guide about Shaiya server security.
I'll be using Windows 7 as my base operating system, and Windows XP Pro for an operating system inside the virtual machine.

This has the advantage of you knowing which machine a screenshot was taken on based on the look of the title bar (Win XP = virtual machine).

Table of Contents
Step 1. Install VirtualBox on your host operating system.
Step 2. Create a new virtual machine
Step 3. Install Windows XP on the virtual machine.
Step 4. Copy your database and server files to the VM.
Step 5. Configure Windows Firewall
Step 6. Check your new IP address
Step 7. Install Software.
Step 8. Run SQL Server Management Studio
Step 9. Run SQL Server Configuration Manager
Step 10. Install Shaiya server services
Step 1. Install VirtualBox on your host operating system.
Go to virtualbox.org and download Virtualbox.
Once downloaded, run the installer to install it.
This is pretty straightforward.
This concludes Step 1.

Step 2. Create a new virtual machine
Start up the Virtualbox software.
[Only registered and activated users can see links. Click Here To Register...]
Click on "New" to create a new virtual machine.

[Only registered and activated users can see links. Click Here To Register...]
You should see the Virtual Machine Wizard pop up, click on "Next".

[Only registered and activated users can see links. Click Here To Register...]
Give the virtual machine a name by filling in the name field, then press "Next".

[Only registered and activated users can see links. Click Here To Register...]
Allocate some memory for the virtual machine, I chose 768MB. Depending on how much memory your system has, you may want to allocate more memory. I wouldn't recommend going much lower than 768MB however. Keep in mind if you allocate mor ememory than is available on your host operating system, the virtual machine may not be able to run. Any time the virtual machine is shut down, you can re-adjust this.

[Only registered and activated users can see links. Click Here To Register...]
Create a new virtual hard disk. We want a boot disk in this case.

[Only registered and activated users can see links. Click Here To Register...]
You should see the Virtual Disk Wizard pop up, click on "Next".

[Only registered and activated users can see links. Click Here To Register...]
Choose a storage type for the virtual hard disk. I chose "Dynamically expanding storage", although either type will work in this case.

[Only registered and activated users can see links. Click Here To Register...]
We want about 15GB of total space for the virtual machine. You can give it more space if you wish, but I would not recommend going much lower than 15GB. I don't know of an easy way to change the virtual disk size later, so it is pretty important you get this right the first time.

[Only registered and activated users can see links. Click Here To Register...]
Here you tell Virtualbox where to save the virtual hard disk file. Type in a file name and click on the button to the right of the "Location" field. The specific name and location are not important in this case. Make sure you choose a location that has room for the virtual hard disk file. That means if you are creating a 15GB file, you must have more than 15GB free space (hopefully a lot more) on the drive you are saving it to.

[Only registered and activated users can see links. Click Here To Register...]
Double-check your settings and click "Next" when you are satisfied with your choices.

[Only registered and activated users can see links. Click Here To Register...]
This completes the Virtual Disk Wizard, press "Finish" to continue.

[Only registered and activated users can see links. Click Here To Register...]
Now we want to configure some things before starting the virtual machine up. Click on "Settings".

[Only registered and activated users can see links. Click Here To Register...]
Click on "Network" in the list on the left side.

[Only registered and activated users can see links. Click Here To Register...]
Choose "Bridged Adapter" from the "Attached to:" drop down.

[Only registered and activated users can see links. Click Here To Register...]
Choose an active network adapter from the list. Your list won't look the same as mine, unless you happen to be using a computer with the exact same network interface cards (NIC) in it. You want to use whichever NIC is connected to your local network. Most likely it is the same NIC that you are using to connect to the internet. In my case I chose my wireless NIC because I am using a laptop that is connected via wireless.

[Only registered and activated users can see links. Click Here To Register...]
When you are satified with your network settings, click on "Storage" in the list on the left side.

[Only registered and activated users can see links. Click Here To Register...]
Here you can choose where the media is that you will use to install Windows XP. Click on "Empty" under "IDE Controller".

[Only registered and activated users can see links. Click Here To Register...]
I chose E: because my Windows XP disc is located in my host operating system's CDROM drive, which is mapped to E: Your media may be located somewhere else, so choose what best suits your configuration.

That should be all you need to do for creating a new virtual machine.
This concludes Step 2.

Step 3. Install Windows XP on the virtual machine.
You should be inside of the virtual machine for Step 3.

Keep in mind when using VirtualBox you can press the right control button at any time to give focus back to the host operating system.
Use right ctrl + delete in place of ctrl + alt + del when logging into windows on the virtual machine.

[Only registered and activated users can see links. Click Here To Register...]
Make sure your operating system media is in the drive, and press press "Start" to start up the virtual machine and begin installing windows.

[Only registered and activated users can see links. Click Here To Register...]
Press Enter to begin the windows installation.

[Only registered and activated users can see links. Click Here To Register...]
Press F8 to agree to the WIndows XP EULA.

[Only registered and activated users can see links. Click Here To Register...]
Press C to create a new partition.

[Only registered and activated users can see links. Click Here To Register...]
You want the partition to be the full size of the virtual hard disk, so press Enter to continue.

[Only registered and activated users can see links. Click Here To Register...]
Press Enter to install Windows XP to the newly created partition.

[Only registered and activated users can see links. Click Here To Register...]
Choose to format the partition with NTFS file system (Quick).

Computer name, passwords, and various settings here are up to you. Just make a note of what you used so you can refer back to it later if need be.
I'll leave the rest of the windows installation to you as I won't be covering that in this guide. Continue to the next step once you have successfully installed windows.
This concludes Step 3.

Step 4. Copy your database and server files to the VM.
You should be inside of the virtual machine for Step 4.
This step will differ depending on how you want to do it because you can do this many different ways. I chose to share them over the local network from my host operating system. Alternative methods of getting your Shaiya server files onto the virtual machine would be to put them on a flash drive, download them from the web, etc, etc. However you want to do it.
You will need to know the location of your database files, and your server files later in the guide. I don't know where you put them or what you named them, or if you even did this step.
I placed my files files on the C: drive under the SHAIYA_SERVER folder like so:
[Only registered and activated users can see links. Click Here To Register...]

If you completed this step successfully, you now have all of your server files on the virtual machine.
This concludes Step 4.

Step 5. Configure Windows Firewall
You should be inside of the virtual machine for Step 5.

Now we want to configure the firewall to open some Shaiya specfic ports on the virtual machine.
[Only registered and activated users can see links. Click Here To Register...]
Press the Windows Start button, and click on "Control Panel".

[Only registered and activated users can see links. Click Here To Register...]
Click on "Switch to Classic View" to see all control panel options.

[Only registered and activated users can see links. Click Here To Register...]
Double-click on "Windows Firewall" to start Windows Firewall.

[Only registered and activated users can see links. Click Here To Register...]
Make sure it is set to "On", and then click on the "Exceptions" tab.

[Only registered and activated users can see links. Click Here To Register...]
Click on "Add Port..." to allow a port through the firewall.

[Only registered and activated users can see links. Click Here To Register...]
The first port we will add will allow outside users to connect the Shaiya login server. Outside users meaning users outside of the virtual machine, which includes your host operating system. Give the port a name relevent to it's use, and type "30800" into the "Port Number:" field. The radio button should be set as TCP. Press "Ok" when you are satified with your changes.

[Only registered and activated users can see links. Click Here To Register...]
Click on "Add Port..." to allow another port through the firewall.

[Only registered and activated users can see links. Click Here To Register...]
The second port we will add will allow outside users to connect the Shaiya game server. Outside users meaning users outside of the virtual machine, which includes your host operating system. Give the port a name relevent to it's use, and type "30810" into the "Port Number:" field. The radio button should be set as TCP. Press "Ok" when you are satified with your changes.

[Only registered and activated users can see links. Click Here To Register...]
Those should be the only two ports needed to successfully connect to the test server from your local network. Press "Ok" when you are finished adding those two ports.
This concludes Step 5.

Step 6. Check your new IP address
First make sure your host operating system is connected to your router. This means you can see other computers on the network (if any) and that you are connected to the internet (likely if you are reading this).

You should be inside of the virtual machine for Step 6.
Since the virtual machine is connected to your local network, you'll be accessing it with it's local IP via the Shaiya game client executable, and not with localhost (127.0.0.1)
A quick test to see if networking appears to be working properly is to open up IE and go to [Only registered and activated users can see links. Click Here To Register...], you should be able to get there if your host OS has internet access.

Let us find out what your local IP address is.

Click on the Windows Start button, and select "Run".
[Only registered and activated users can see links. Click Here To Register...]
You should see the Run box appear. Type in "cmd" and click "Ok".

[Only registered and activated users can see links. Click Here To Register...]
A black window with a blinking cursor should pop up, this is the command prompt. Type in "ipconfig" and press the enter key.
This will show you your virtual machine's local IP address on the "IP Address" line. This shouldn't be a 169.x.x.x IP address, that usually means the network adapter could not find a dhcp server. Also it probably should not be a 10.x.x.x IP address, that mostly likely means the virtual machine's network adapter is set to "NAT" instead of "bridged adapter". Almost always with a home router you will be assigned a 192.168.x.x IP address.

[Only registered and activated users can see links. Click Here To Register...]
Now that we have the IP address of the virtual machine, we need to change it in one of the Shaiya server configuration files.
Navigate to D:\SHAIYA_SERVER\SERVER\PSM_Client\Bin\Config\ and double-click the ps_game.ini file to open it in Notepad.

[Only registered and activated users can see links. Click Here To Register...]
You wan to change the line that starts with "GamePublicIP=". Highlight the old IP address that is there.

[Only registered and activated users can see links. Click Here To Register...]
Now type in your virtual machine's IP address that we just found.
This concludes Step 6.

Step 7. Install Software.
You should be inside of the virtual machine for Step 7.
Before you can install SQL Server under Windows XP, you'll need to install some prerequisites. There aren't really any decisions to make here except that you wish to install these.
Microsoft Windows XP Service Pack 3 - [Only registered and activated users can see links. Click Here To Register...]
Microsoft Windows Powershell 2.0 - [Only registered and activated users can see links. Click Here To Register...] I used the "Update for Windows XP and Windows Embedded, x86-based versions" version.
Microsoft DotNet 3.5 - [Only registered and activated users can see links. Click Here To Register...]
Microsoft Windows Installer - [Only registered and activated users can see links. Click Here To Register...]
Reboot as necessary.
Once you have those installed, you can move on to installing SQL Server Express 2008 R2.

Install SQL Server Express 2008 R2.
I used SQLEXPRWT_x86_ENU.exe which includes SQL Server Management Studio. I got it from here: [Only registered and activated users can see links. Click Here To Register...]
The version of SQL Server 2008 R2 named SQLEXPR_X86_ENU.exe DOES NOT contain management studio FYI.
Run the installer and you should see a screen like this:
[Only registered and activated users can see links. Click Here To Register...]
Click on "New installation or add features to an existing installation".

[Only registered and activated users can see links. Click Here To Register...]
Check "I accept the license terms." and then press "Next" to continue.

[Only registered and activated users can see links. Click Here To Register...]
Here you can leave everything the default if you'd like. Press "Next" to continue.

[Only registered and activated users can see links. Click Here To Register...]
Make sure "Default Instance" is selected here. Press "Next" to continue.

[Only registered and activated users can see links. Click Here To Register...]
Choose "NETWORK_SERVICE" from the Account Name drop down next to the SQL Server Database Engine service. Press "Next" to continue.

[Only registered and activated users can see links. Click Here To Register...]
Choose "Mixed Mode" for Authentication Mode. Now enter the password for the "sa" (system administrator) account. You will probably want to enter the same password that your Shaiya server files are configured for in the .ini files. Keep in mind the password is case sensitive. Press next to continue.

[Only registered and activated users can see links. Click Here To Register...]
You can just press "Next" here to finish up the installation.
This concludes Step 7.

Step 8. Run SQL Server Management Studio
You should be inside of the virtual machine for Step 8.
[Only registered and activated users can see links. Click Here To Register...]
Run your freshly installed SQL Server Management Studio.

[Only registered and activated users can see links. Click Here To Register...]
Select "Windows Authentication" and press "Connect".

[Only registered and activated users can see links. Click Here To Register...]
Expand Security, and then expand Logins. You should see an account named "sa", it is the default system administrator account. You want to rename this account to whichever account your Shaiya server files are configured for. Highlight the "sa" account and press F2 to rename. Type in the new account name and press enter. I chose to name the account "shaiya" in this example.

[Only registered and activated users can see links. Click Here To Register...]
The account you just renamed should now match the credentials of your Shaiya server configuration files.

[Only registered and activated users can see links. Click Here To Register...]
Now we want to attach your server's database files. Expand the "Databases" tree.

[Only registered and activated users can see links. Click Here To Register...]
Right-click on "Databases" and select "Attach...".

[Only registered and activated users can see links. Click Here To Register...]
Click on "Add...".

[Only registered and activated users can see links. Click Here To Register...]
Remember when you copied your server files to the virtual machine earlier? Now you want to navigate to there and select the first database to attach. In this case it is "PS_Billing_Data.MDF". Highlight the database and press "Ok".

[Only registered and activated users can see links. Click Here To Register...]
Continue adding the rest of the databases, then press "Ok" when finished.

[Only registered and activated users can see links. Click Here To Register...]
You should now see the newly attached databases listed under the "Databases" tree.
This concludes Step 8.

Step 9. Run SQL Server Configuration Manager
You should be inside of the virtual machine for Step 9.

Now we need to configure some settings for SQL Server.

[Only registered and activated users can see links. Click Here To Register...]
Run SQL Server Configuration Manager.

[Only registered and activated users can see links. Click Here To Register...]
Expand the "SQL Server Network Configuration" tree and click on "Protocols for MSSQLSERVER".

[Only registered and activated users can see links. Click Here To Register...]
Double-click on "Named Pipes" protocol.

[Only registered and activated users can see links. Click Here To Register...]
When the "Named Pipe Properties" window pops up, choose "Yes" in the Enabled drop down.

[Only registered and activated users can see links. Click Here To Register...]
Press "Ok" to continue.

[Only registered and activated users can see links. Click Here To Register...]
Press "Ok" once you have read and understand the warning message.

[Only registered and activated users can see links. Click Here To Register...]
Double-click on the TCP/IP protocol.

[Only registered and activated users can see links. Click Here To Register...]
When the "TCP/IP Properties" window pops up, choose "Yes" in the Enabled drop down. Do the same for the VIA protocol.

[Only registered and activated users can see links. Click Here To Register...]
Now click on the "IP Addresses" tab.

[Only registered and activated users can see links. Click Here To Register...]
Choose "Yes" in the Enabled drop down under the IP1 section.

[Only registered and activated users can see links. Click Here To Register...]
Choose "Yes" in the Enabled drop down under the IP2 section, and press "Ok" to continue.

[Only registered and activated users can see links. Click Here To Register...]
Expand the "SQL Native Client 10.0 Configuration" tree and click on "Client Protocols".
Double-click on "VIA" on the right side.

[Only registered and activated users can see links. Click Here To Register...]
When the "VIA Properties" window pops up, choose "Yes" in the Enabled drop down.

[Only registered and activated users can see links. Click Here To Register...]
Press "Ok" to continue.

Now restart the SQL Server service for changes you just made to take effect.
This concludes Step 9.

Step 10. Install Shaiya server services
You should be inside of the virtual machine for Step 10.

Now it is finally time to install the Shaiya server services.
[Only registered and activated users can see links. Click Here To Register...]
Navigate to D:\SHAIYA_SERVER\SERVER\PSM_Client\PSM_AgentInstal l.exe and double-click on it to run it.

[Only registered and activated users can see links. Click Here To Register...]
Press "Ok" to confirm that the service was installed and started successfully.

[Only registered and activated users can see links. Click Here To Register...]
Click on the "Apply window registry" button. Nothing will happen to tell you if this was successful or not, so press "Close" to continue.

[Only registered and activated users can see links. Click Here To Register...]
Navigate to D:\SHAIYA_SERVER\SERVER\PSM_Server\PSMServer_Mgr.e xe and double-click on it to run it.

[Only registered and activated users can see links. Click Here To Register...]
When the Server Patch Config window pops up click on "Server Setup" on the menu, and choose "Service Install All". The services should now turn to green pause symbols.

[Only registered and activated users can see links. Click Here To Register...]
Now click on "Control Service" on the menu, and choose "Start All Server Service". If everything was set up correctly, all the services should turn to green arrows. If you are like me and make mistakes, then something probably did not work, and you will have to troubleshoot it. I've included a basic troubleshooting guide after this section just for that occasion.
This concludes Step 10.


COMMON PROBLEMS in order of server set up completeness (from starting services to logging into Shaiya and performing in-game actions):
All services show a red X
This is most likely to your Shaiya Agent Client service (D:\SHAIYA_SERVER\SERVER\PSM_Client\PSM_Agent.exe) not being installed and/or not running. Get it installed and started, and restart PSMServer_Mgr.exe if needed.

All services show a green x
This means your services are not installed, or are not being recognized as being installed.

Services go to a green arrow, but then back to pause
This usually means the services were unable to connect to the database. Check your logs in D:\SHAIYA_SERVER\SERVER\PSM_Client\Bin\Log and D:\SHAIYA_SERVER\SERVER\PSM_Client\Log. These logs help tell you of problems with services starting, so keep that in mind for future problems.

Check notice board
Usually caused by connecting to the wrong IP address, or Windows Firewall blocking the client.
Can also be cause by using the wrong game client, thus connecting to the wrong IP address.

Failed to connect to game server, after selecting server and clicking ok
May be caused by Windows Firewall blocking the client trying to connect to the server.
Can also be caused by the incorrect IP address entered in D:\SHAIYA_SERVER\SERVER\PSM_Client\Bin\Config\ps_g ame.ini on the line that starts with GamePublicIP=
It could possibly also be from incorrect IP addresses in other .ini files.

Disconnect after selecting game server and clicking ok
Most likely you have incorrect or missing data in your database. There could be many causes of this. I'd suggest using the SQL profiler to trace what happens in this case and look for error messages in the logs. If there is an error message present in the logs try to find which SQL query that you traced with the profiler caused it.

Disconnect after less than 2 minutes of being connected to the server
Usually caused by forgetting to run the /nprotectoff command. Normally this needs to be run every time the server services are restarted, which includes server reboots, etc.

Disconnect when targetting mobs, or doing other specific activities
Most likely you have incorrect or missing data in your database. There could be many causes of this. I'd suggest using the SQL profiler to narrow down the problem.

Crashes when buying an item from the item mall.
The Distributed Transaction Coordinator service may not be running, it is required to use the statement: BEGIN DISTRIBUTED TRANSACTION
SHAIYA PORT LIST (Source: NocturnalSniper)
SQL Server - port 1433 - protocol - TCP/UDP
login server - port 30800 - protocol - TCP
game server - port 30810 - protocol TCP
session - port 30900 - protocol TCP
userlog - port 30901 - protocol TCP
dbagent - port 30911 - protocol TCP
gamelog - port 30912 - protocol TCP
Psmagent - port 40900 - protocol TCP
connectionManager - port 1060 - protocol TCP
dbagent2 - port 1056 - protocol TCP
gamelog - port 1072 - protocol TCP
Credits:
Zerosignal - For creating the original tutorial.
ProfNerwosol - For lots of additional information.
EC - For letting me focus on web development.
Whoever released the databases and server files to begin with.
12/13/2010 09:26 PraDevil[ELITE]#2
superb guide!! well thanks ;)
12/17/2010 19:11 ProfNerwosol#3
This might be best up to date tutorial on how to set up a private server. Bravo.

I'd like to add something though.
You can install server services using a program in PSM_Client ... PSM_ServiceMgr.exe ... and start them too. I'd suggest to use the Server Patch Config tool. The services need to be started in an order or they will return to paused state.
12/17/2010 21:38 abrasive#4
I'm not quite following you.

I installed the Agent service from D:\SHAIYA_SERVER\SERVER\PSM_Client\PSM_AgentInstal l.exe

Then I install all of the other services from the Server Patch Config tool.

I've never had to start the services in a specific order to keep them from going back to paused. What did you mean by needing to start them in a specific order?
12/18/2010 23:42 ProfNerwosol#5
Quote:
Originally Posted by abrasive View Post
I'm not quite following you.

I installed the Agent service from D:\SHAIYA_SERVER\SERVER\PSM_Client\PSM_AgentInstal l.exe

Then I install all of the other services from the Server Patch Config tool.

I've never had to start the services in a specific order to keep them from going back to paused. What did you mean by needing to start them in a specific order?
There are two ways of installing and starting the services. The Server Patch Config and PSM_ServiceMgr.exe.

Server Patch Config already starts everything in the order it needs to be, so you don't have to worry about it. Still, it's good to be aware of it.

Try starting Game first without DBAgent or Login then Session. You need some services to be started before the others. I assume they depend on each other and when one starts it provides some functionality for the next one.
01/07/2011 23:53 Bаne#6
# superb bro

# added to collection of guides.

# request sticky
01/16/2011 04:17 Bаne#7
Bumped
01/19/2011 16:12 .:ComputerKränk:.#8
translate this in German pls^^
Work this on hamachi??
01/29/2011 18:53 KyleH112#9
im having trouble changing the ip address with the Hex editor, I find the ip address but when I change it, it still seems to connect to shaiya's regular server still.
01/30/2011 23:54 R0CK7Y#10
dude are u GOD!!!!! because i think so :D
i got the VirtualBox instaled already i'll see how can i try it out :D
thx
02/06/2011 06:14 ShaiyaOmega#11
Bump...
Request Sticky...
02/18/2011 18:14 mertkanka#12
ı dowlander episode 5 database helpme link ( url ) dowland pls
04/29/2011 20:10 aboldijar2#13
By making a virtual machine will other players be able to connect on the server to play without hamachi or it is only local one?
05/01/2011 07:19 abrasive#14
Quote:
Originally Posted by aboldijar2 View Post
By making a virtual machine will other players be able to connect on the server to play without hamachi or it is only local one?
You can forward your rotuer ports for the Shaiya login and game server to the VM's internal IP address, and let players connect externally if you wish. It is better meant for a test server because by nature a virtual machine is slower than hosting it natively.
06/25/2011 06:16 Bаne#15
BUMPED :D