Flub© | 09.22.20
What's the most efficient way to run a RuneScape Private Server (RSPS) in 2020?
The age old question asked by server owners is finally answered on RuneAd!
I'm writing this blog on the premise that you're either already running your server, or you're planning to in the near future.
Firstly, congratulations making it this far! Running a server is one of the most rewarding experiences that you can participate in within the RuneScape community.
Now, onto the good stuff!
There are a ton of different guides out there which will explain how to run your server on Eclipse, via remote desktop onto an overpriced and underperforming Windows VPS.
What if I told you that you're wasting a ton of money? Well - I wouldn't be lying!
What are we trying to achieve?
Most of you will be comforted by the familiar feel of a Windows server. Don't get me wrong, when starting out they are a fantastic option for that exact reason! However, if you're looking to maximise the performance of your game by;
- Minimising lag (Network Ping / Latency)
- This is the time it takes for your players to receive information from the server. This becomes extremely important with PKing / PvMing
- Improving the RAM management of Java
- As your server grows in player count, so will your need for additional server resources.
- Maximising the security of your server
- Reducing the risk of MySQL Database hacks
- Reducing the chances of player data being altered / deleted
- Minimising the risk of password leaks
- Reducing the chances of unauthorised access to your VPS
- Improving network security
- Minimise the scope of attacks that a DDOS could take advantage of
- Reduce the likelihood of an attack being successful
- Keep your server running longer - we want a 24/7 service for our players to enjoy!
- Save money
- All of the above will help with long term running costs
Now, how can we do this?
One word.. Linux!
That's right - I said Linux! That nerdy and totally confusing operating system known for.. well, not much in the life of an average user!
However - Grant access to this legendary OS for an enthusiast, and watch the savings pile up!
What is Linux?
There are several versions of 'Linux'. However in a nutshell, Linux is a free and open source operating system. It is designed, built and perfected by a huge dedicated community who all strive to create the fastest and most secure systems possible!
Due to being open source, Linux is known to be the most customisable group of operating systems in the world.
Some notable uses;
- Android - Yes, that's Linux!
- Websites - Most of the internet is hosted on CentOS or Ubuntu servers!
- ioT Devices
- Standalone devices such as security cameras
Okay, so Linux sounds pretty handy.. How can I use it?!
I'm glad you asked! Firstly, you'll want to find yourself a reputable hosting company to purchase a VPS (Virtual Private Server)
We recommend OVH - They provide free DDOS protection and excellent scalability should you need it.
Then, you'll want to setup the VPS for the first time! Now, this can be daunting since we will be recommending that you install Ubuntu 20.04 as your operating system.
Some things to bare in mind when making your purchase;
- Linux servers are hyper efficient, so don't fool yourself into buying the top tier!
- Most of you will be fine with 2 virtual CPU Cores, and 4-8 GB of RAM.
- Server Location - You should pick a data centre as close as possible to the majority of your players.
- Network Speed - You'll want an absolute minimum of 200mbps and unlimited bandwidth. But we recommend 500mbps.
How to setup your server for the first time!
Due to Linux being such a widely adopted operating system, there are literally thousands of online guides which detail exactly how to setup your server.
You can find a great example here. However, I will detail the most important steps below;
Connecting to your server
- Download a program to connect to your server using SSH.
- I recommend Termius as it features cross-platform syncing, pre-defined code snippets and more!
- A free alternative is PuTTY for Windows, or the standard Terminal for Mac or Linux
- Enter the IP address of the server
- Enter the username (Usually Ubuntu)
- Enter the password
- If required, select port 22
- If done right, you should be connected to your server - Woohoo!
Changing your password
There really is no need to explain this part!
- Once you're connected, type 'passwd'
- You'll be asked to confirm your current password. Simply right click or CTRL+V (CMD+V for Mac).
- Hit return, and then enter your new password twice
- Make sure you use an extremely secure password! We recommend using a password manager & generator such as the free to use LastPass.
Updating your VPS
When you install Ubuntu, your hosting company will usually use a pre-defined version that they have stored. To ensure you have the latest security and software updates, do the following!
- Type 'sudo apt-get update'
- Note: Typing 'sudo' before a command will run it with administrator (known as root) permissions
- Next, type 'sudo apt-get upgrade'
- If prompted, press 'Y' to confirm you'd like to update
- Lastly, type 'sudo apt-get dist-upgrade
After you've done this, I recommend rebooting with the command 'sudo reboot'. After around 10 seconds, you can then reconnect (Remember to use the new password that you set!)
Installing Required Software
To run your server on your new VPS, you'll need a few things!
- Java - To install Java, type 'sudo apt-get install default-jre'
- Unzip - To allow unzipping archives, type 'sudo apt-get install unzip'
- You can also install Zip with 'sudo apt-get install zip'
That's it! You're ready to move onto the next step!
Configuring your firewall
It's extremely important to secure your new VPS for reasons obvious to most of you.
Ubuntu by default is open for the world to see. You can check what access others have with a network scanning tool.
I recommend doing a scan now that you can later compare results with, to ensure your firewall is working as it should be.
Luckily - Ubuntu comes packaged with a super simple, secure and efficient firewall configurator called UFW!
- Type 'sudo ufw allow ssh'
- This is the most important step. Forgetting this will block you from reconnecting to your VPS!
- Next, 'sudo ufw allow mysql'
- If you're not planning on using MySQL, skip this step
- Block the remaining open ports found on the network scan that you did!
- 'sudo ufw deny 443' <- In this example, we're blocking all traffic on port 443.
- If the service is popular, you can use 'sudo ufw deny http' <- In this example, we block all http access to the VPS.
- Allow your Java server port
- Usually, 'sudo ufw allow 43594'
- After you've done this, type 'sudo ufw enable'
- Then, reboot with 'sudo reboot'
Once your VPS has booted back up, reconnect and login as normal. You should find you're able to connect and things seem just as they were before!
Now, type 'sudo ufw status verbose' to see a full list of the ports allowed / denied.
Next, you'll want to re-run the scan you did earlier and check that the ports now show as either 'blocked' or ideally 'filtered'
If yes, well done! You've just configured a firewall!
Getting your server files onto your VPS
Okay so far so good. Now what?
- Download an 'FTP' client such as FileZilla!
- Press CTRL+S (CMD+S for Mac) to open the 'site manager'
- Enter your IP, Username and Password
- Select 'SFTP' as your method in the top right box
- Select port 22
Now, you'll want to make a new directory. You can do this with FileZilla by simply using the right click option.
Note: You can also do this with a command, type 'mkdir MyServerNameHere'
- Now, zip your entire server on your PC
- Copy the zip folder over to the new folder on your VPS
- Go back to your SSH command line client, and type 'ls' to view the files available to you in the current directory
- If you're in the wrong folder, type 'cd YourFolderNameHere'
- Now to unzip your server simply type 'unzip ./YourServerName'
- Using the tab key to auto complete file names will be a massive help
- You'll notice how fast your VPS will unzip the file compared to a Windows Server or PC!
Getting your server running!
Wow, they grow up so fast! We're finally ready to run our server!
You'll want to copy your current Run.bat file and take a look how it's setup.
Here is an example: sudo java -server -Xmx12288m -cp bin:lib/* com.janus.GameServer
- sudo java - This runs Java with administrator (root) rights
- -server - This tells Java we're running a server with users who will be connecting remotely
- -Xmx12288m - The amount of RAM to assign the VM.
- I recommend taking the total RAM of the VPS - 2GB
- Ensure you go up in increments of 1024.
- Eg. 4 GB of RAM is 1024 x 4 = 4096
- -cp bin:lib/* - We're telling Java that the classpath is the bin folder, and the supporting Jar libraries are in the lib folder
- If you run this command, ensure that those folders are in the same directory.
- You can check by typing 'pwd' to print the Current Working Directory (File Path)
- com.janus.GameServer - This is the path to your main Class file.
- E.g. bin/com/janus/GameServer
Hopefully that's it!
If you followed all of this successfully, you're likely now running your first ever server on a Linux VPS!
But wait.. Closing the SSH command line program completely crashes your server!
Don't worry, that's normal! To allow Java to continue running in the background, we'll use 'Screen'
- Create a screen session
- screen -s SERVERNAME
- You'll be entered automatically to this background instance.
- Any program now ran inside of this screen session will remain active upon disconnection
- Run your server
- Minimise the screen session.
- To do this, hold 'CTRL' then press A, followed by D.
- Later, if you need to reconnect, simply type 'screen -r SERVERNAME
If you managed to follow all of this, a massive well done to you! You've hopefully learned an amazing skill and you're likely feeling pretty awesome about it!
You'll now have access to a much cheaper way of hosting your server, as well as notably better performance!
My own server - Janus - has been hosted on a Ubuntu VPS since I launched it over 5 months ago! I can proudly say that we've never gone offline for any reason that wasn't directly caused by us shutting down / rebooting / breaking something!
- Google is your friend! As I mentioned earlier, Ubuntu is one of the most used systems in the entire world when it comes to servers, if you can think of it, someone else has already answered it!
- Contact me - I work with servers for a living and would be more than happy to advise on the purchase, followed by fully setting up and configuring the VPS for safe use!
Find me in the Janus Discord, RuneAd Discord or RuneAd Community Forums!
Add me on Discord Directly: Flub©#0001
Check out Janus!