Hosting a JK2 Server with JK2MV (Windows / Linux)
Posted: 28 Apr 2016, 14:09
So, you want to host a JK2 server? Well, there's a right way and a few wrong ways! This is a step-by-step guide on how to host a base server
for both 1.02 and 1.04 using JK2MV, on both Windows and Linux. I plan on adding more to this as I go along, maybe with some screenshots, setting up with mods, etc.
If you get stuck at all, please post below how you are stuck and your error log (if there is one).
Without further ado, let's get into this.
Windows:
1. Download the Dedicated Server Package on the JK2MV Downloads.
2. Create a "portable" Gamedata folder preferably on your desktop. This part is not necessarily mandatory, however it's much cleaner, and if it's not home-hosted (or on your personal computer), then this step becomes mandatory. Drag all the game contents into this almost as if you are about to play it.
3. Extract the corresponding server executable (ie 32-bit or 64-bit) into your Gamedata. I would avoid putting mods / maps in for now until you have everything running.
4. Now, you'll need a server configuration file, an executable which reads all of the server's settings. Here you can adjust to your liking (Server name, bots, force / no force, weapons / no weapons, server slots, password, connecting message, etc). There's many options. If you're unfamiliar with looking at server configs for JK2, things may confuse you at first. However, I'm attaching a sample server.cfg which explains the most vital points of a server configuration file.
SAMPLE SERVER CONFIG:
By the way if you are not sure how to make a server config file, Just copy the sample server config and paste it in a blank Notepad file. File -> Save, and name it server.cfg
Let's review the files. This is what your folder should look like:
(inside Gamedata folder)
base <- folder
jk2sp.exe
jk2mp.exe
jk2mvded.exe
(inside base folder)
assets0.pk3
assets1.pk3
assets2.pk3
assets5.pk3
server.cfg
(If this is a 1.02 server, then you will be missing assets2 and assets5)
Your system depends on which jk2mvded you should take. Windows = win32 - x64, or win32 - x86. Linux = i386 (32bit) or amd64 (64bit). When you pick the one, I suggest renaming it to just "jk2mvded.exe" instead of "jk2mvded-v1.1.1-win32-x64.exe" or whichever one you are using.
Port Forwarding
Now comes the worst part. This is usually where people give up (mostly if they are home hosting). Your server runs on a port. In this case, the port 28070 is the default, and you are going to have to add a port forward exception on your router's firewall (once again, if home hosting). Now, since every router / provider is different, this part is unfortunately going to be very bland and lacklustre in terms of detail.
Basically, you will want to log onto your router by entering your Router's IP into your web browser. (this can be found by doing /ipconfig all in cmd). For example, 192.168.1.1 is a very common one.
Once logged in, you will want to find your way to your Firewall settings in the router's panel, and/or find something that pertains to Port Forwarding. Select the device you want the port forward to take in affect (for example, maybe your server's IP is 192.168.1.7) and add 28070. When asked if it's TCP or UDP, it's UDP, however I usually just select both if I have the option. If your router has a port range, then enter 28070 - 28071. Apply the settings.
///
Now that the port forwarding is complete, you are now ready to run your server.
On Windows, there's 2 main methods of running your server. I will show you the smarter way.
Open a blank Notepad file, and enter the following:
So, fs_game is the gamepath we are leading. If we were hosting a DS-Online server, we'd change this to +set fs_game DS-Online.
+set net_port 28070 just reassures that we will be using the port 28070.
And +exec server.cfg is to read all your settings for the server.
Now, File -> Save , and name this whatever you want with a batch file extension at the end. I suggest maybe something like "server.bat".
You're ready to run the server. Double-click your server.bat and it should open a cmd-type window. You can check if it's running by typing in "status" in the window once everything is done loading. If you get a crash error, it's likely it's because of something in your server.cfg file, however there's many errors and it cannot be for sure, so post your errors if you get one.
Check in-game to see if you can find your server. If it's not there right away, give it a couple minutes. If you don't see anything after that, it's most likely a port forwarding issue. If you are stuck on port forwarding with your provider, try looking up "port forwarding <provider name>" or maybe even <router type> to see if you can find an in-depth tutorial on how to port forward with your device. It does not matter if it's JK2 or not; the idea is basically the same as long as if it's a UDP port.
///
Linux:
This mostly goes under the lines of using a VPS (Virtual Private Server), usually leased by a company. Using a Game Panel will be like half the effort but twice the amount of money. There's a few steps that are pretty similar to the Windows setup, however overall both methods are pretty different.
1. Download the Dedicated Server Package on the JK2MV Downloads.
2. Download an FTP program if you don't already have one (Recommended: WinSCP or FileZilla)
3. Create a portable Gamedata folder and call it either jk2 or .jkii (This is now mandatory and not optional since this is not being home-hosted)
4. Extract the corresponding server executable (ie i386 or amd64) into your Gamedata. I would avoid putting mods / maps in for now until you have everything running.
5. Now, you'll need a server configuration file, an executable which reads all of the server's settings. Here you can adjust to your liking (Server name, bots, force / no force, weapons / no weapons, server slots, password, connecting message, etc). There's many options. If you're unfamiliar with looking at server configs for JK2, things may confuse you at first. However, I'm attaching a sample server.cfg which explains the most vital points of a server configuration file.
SAMPLE SERVER CONFIG:
Let's review the files. This is what your folder should look like:
(inside home/jk2)
..
base <- folder
jk2sp.exe
jk2mp.exe
jk2mvded
(inside base)
..
assets0.pk3
assets1.pk3
assets2.pk3
assets5.pk3
server.cfg
I suggest renaming your jk2mvded-v1.1.1-linux-i386 (or amd64) to just jk2mvded to save some typing.
Before we run the server, you must set permission settings to the jk2mvded. In your FTP window, right click on jk2mvded -> Properties. You should see a grid of check fields. The very right row should be all unchecked. Check them all from top to bottom (Read, Write, etc).
We are now ready. Log onto your VPS through Terminal, Putty, or whatever it is you use.
The command allows you to:
* Use multiple shell windows on a single session
* Run a process for a long time in the background and able to disconnect while it still runs
This is how your JK2 server will keep its uptime.
If you don't have screen, then enter the following command:
Once complete, we're ready. Type in the following:
Press enter. Will prompt you to press enter 1 or 2 more times.
Now, navigate to your jk2 folder.
And now run the server.
Press enter.
If you get this error:
this means that your permission settings are still not set correctly.
Otherwise, your server should be running. Type status to see.
If you get any errors, please paste them below.
You can minimize the server in the cmd window by pressing Ctrl + A, then D.
To quit the server, press Ctrl + A, then type :quit
To get back to your server session, type in:
If you have multiple screen sessions, you'd type in
This shows your list of screen sessions occurring.
Let's say one of your sessions is named 2842. To access, enter:
Now, you can also name your session to save some time if you'd like.
Enter:
(you don't have to use jk2server...just a basic example)
and then from there, you enter:
You could also make a startscript instead of typing the previous command every time. I personally just got into the habit of typing it in each time.
///
for both 1.02 and 1.04 using JK2MV, on both Windows and Linux. I plan on adding more to this as I go along, maybe with some screenshots, setting up with mods, etc.
If you get stuck at all, please post below how you are stuck and your error log (if there is one).
Without further ado, let's get into this.
Windows:
1. Download the Dedicated Server Package on the JK2MV Downloads.
2. Create a "portable" Gamedata folder preferably on your desktop. This part is not necessarily mandatory, however it's much cleaner, and if it's not home-hosted (or on your personal computer), then this step becomes mandatory. Drag all the game contents into this almost as if you are about to play it.
3. Extract the corresponding server executable (ie 32-bit or 64-bit) into your Gamedata. I would avoid putting mods / maps in for now until you have everything running.
4. Now, you'll need a server configuration file, an executable which reads all of the server's settings. Here you can adjust to your liking (Server name, bots, force / no force, weapons / no weapons, server slots, password, connecting message, etc). There's many options. If you're unfamiliar with looking at server configs for JK2, things may confuse you at first. However, I'm attaching a sample server.cfg which explains the most vital points of a server configuration file.
SAMPLE SERVER CONFIG:
Let's review the files. This is what your folder should look like:
(inside Gamedata folder)
base <- folder
jk2sp.exe
jk2mp.exe
jk2mvded.exe
(inside base folder)
assets0.pk3
assets1.pk3
assets2.pk3
assets5.pk3
server.cfg
(If this is a 1.02 server, then you will be missing assets2 and assets5)
Your system depends on which jk2mvded you should take. Windows = win32 - x64, or win32 - x86. Linux = i386 (32bit) or amd64 (64bit). When you pick the one, I suggest renaming it to just "jk2mvded.exe" instead of "jk2mvded-v1.1.1-win32-x64.exe" or whichever one you are using.
Port Forwarding
Now comes the worst part. This is usually where people give up (mostly if they are home hosting). Your server runs on a port. In this case, the port 28070 is the default, and you are going to have to add a port forward exception on your router's firewall (once again, if home hosting). Now, since every router / provider is different, this part is unfortunately going to be very bland and lacklustre in terms of detail.
Basically, you will want to log onto your router by entering your Router's IP into your web browser. (this can be found by doing /ipconfig all in cmd). For example, 192.168.1.1 is a very common one.
Once logged in, you will want to find your way to your Firewall settings in the router's panel, and/or find something that pertains to Port Forwarding. Select the device you want the port forward to take in affect (for example, maybe your server's IP is 192.168.1.7) and add 28070. When asked if it's TCP or UDP, it's UDP, however I usually just select both if I have the option. If your router has a port range, then enter 28070 - 28071. Apply the settings.
///
Now that the port forwarding is complete, you are now ready to run your server.
On Windows, there's 2 main methods of running your server. I will show you the smarter way.
Open a blank Notepad file, and enter the following:
Code: Select all
jk2mvded +set fs_game base +set net_port 28070 +exec server.cfg
+set net_port 28070 just reassures that we will be using the port 28070.
And +exec server.cfg is to read all your settings for the server.
Now, File -> Save , and name this whatever you want with a batch file extension at the end. I suggest maybe something like "server.bat".
You're ready to run the server. Double-click your server.bat and it should open a cmd-type window. You can check if it's running by typing in "status" in the window once everything is done loading. If you get a crash error, it's likely it's because of something in your server.cfg file, however there's many errors and it cannot be for sure, so post your errors if you get one.
Check in-game to see if you can find your server. If it's not there right away, give it a couple minutes. If you don't see anything after that, it's most likely a port forwarding issue. If you are stuck on port forwarding with your provider, try looking up "port forwarding <provider name>" or maybe even <router type> to see if you can find an in-depth tutorial on how to port forward with your device. It does not matter if it's JK2 or not; the idea is basically the same as long as if it's a UDP port.
///
Linux:
This mostly goes under the lines of using a VPS (Virtual Private Server), usually leased by a company. Using a Game Panel will be like half the effort but twice the amount of money. There's a few steps that are pretty similar to the Windows setup, however overall both methods are pretty different.
1. Download the Dedicated Server Package on the JK2MV Downloads.
2. Download an FTP program if you don't already have one (Recommended: WinSCP or FileZilla)
3. Create a portable Gamedata folder and call it either jk2 or .jkii (This is now mandatory and not optional since this is not being home-hosted)
4. Extract the corresponding server executable (ie i386 or amd64) into your Gamedata. I would avoid putting mods / maps in for now until you have everything running.
5. Now, you'll need a server configuration file, an executable which reads all of the server's settings. Here you can adjust to your liking (Server name, bots, force / no force, weapons / no weapons, server slots, password, connecting message, etc). There's many options. If you're unfamiliar with looking at server configs for JK2, things may confuse you at first. However, I'm attaching a sample server.cfg which explains the most vital points of a server configuration file.
SAMPLE SERVER CONFIG:
(inside home/jk2)
..
base <- folder
jk2sp.exe
jk2mp.exe
jk2mvded
(inside base)
..
assets0.pk3
assets1.pk3
assets2.pk3
assets5.pk3
server.cfg
I suggest renaming your jk2mvded-v1.1.1-linux-i386 (or amd64) to just jk2mvded to save some typing.
Before we run the server, you must set permission settings to the jk2mvded. In your FTP window, right click on jk2mvded -> Properties. You should see a grid of check fields. The very right row should be all unchecked. Check them all from top to bottom (Read, Write, etc).
We are now ready. Log onto your VPS through Terminal, Putty, or whatever it is you use.
The
Code: Select all
screen
* Use multiple shell windows on a single session
* Run a process for a long time in the background and able to disconnect while it still runs
This is how your JK2 server will keep its uptime.
If you don't have screen, then enter the following command:
Code: Select all
sudo apt-get install screen
Code: Select all
screen
Now, navigate to your jk2 folder.
Code: Select all
cd home/jk2
Code: Select all
./jk2mvded +set fs_game base +set net_port 28070 +exec server.cfg
If you get this error:
Code: Select all
jk2mvded : Permission denied
Otherwise, your server should be running. Type status to see.
If you get any errors, please paste them below.
You can minimize the server in the cmd window by pressing Ctrl + A, then D.
To quit the server, press Ctrl + A, then type :quit
To get back to your server session, type in:
Code: Select all
screen -r
Code: Select all
screen -ls
Let's say one of your sessions is named 2842. To access, enter:
Code: Select all
screen -x 2842
Enter:
Code: Select all
screen -AmdS jk2server
and then from there, you enter:
Code: Select all
cd jk2
Code: Select all
./jk2mvded +set fs_game base +set net_port 28070 +exec server.cfg
///