We Are Not Pair!!! Unofficial Guide!!!
Note: The following applies to VPS and QS account types ONLY! Please be aware, you cannot host a Minecraft server on a shared hosting account! Running a daemonized process on a shared hosting server is against Pair’s hosting policies.
If you’re unsure what account type you have, you can find out by following the steps in their official help article on the subject.
Tags
Account Type: VPS/QS
Difficulty: Medium
Overview
We’ll be installing a vanilla Minecraft server on a Pair VPS 1. The VPS 1 server has 4 cores and 4 GBs of RAM. I tried installing a Minecraft server on a VPS Starter II account type (2 cores, 2 GB ram) and unfortunately that was just not powerful enough to handle a Minecraft server. The recommended amount of ram for a Minecraft server is at least 1 GB. That’s half the system memory for one of the VPS Starters types.
Any mods or additional players will add to the strain on the game server. It is very difficult to run a lot of minecraft mods like you may be able to do when playing on your own computer at home. That is unless you have the server hardware to back it up.
Server Setup
First, you’ll want to connect to your hosting server using SSH.
Once you’re ssh’ed to the server you’ll want to create a new directory called “Minecraft” and cd down into it.
mkdir ~/Minecraft
cd ~/Minecraft/
After that you’ll want to download the latest Minecraft server version. You can do so using the command below.
echo 'curl -O "$(curl -s $(curl -s https://launchermeta.mojang.com/mc/game/version_manifest.json | jq -r ".versions[] | select(.id==\"$(curl -s https://launchermeta.mojang.com/mc/game/version_manifest.json | jq -r '.latest.release')\") | .url") | jq -r ".downloads.server.url")"'|bash
Alternatively, you can also find a copy of the latest server.jar file on Mincraft’s official site. If you right click on the server.jar file on that page page then select “Copy link address” and paste it into a curl -O YOUR_URL_HERE
command, you’ll download the server.jar file into the ~/Minecraft directory.
Java Setup
Next you’ll need to download the latest version of Java. As of the time of writing this (early 2022), the most up-to-date version of Java released is Java 17, with Java 18 coming out soon.
To download Java 17.
curl -O https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz
Alternatively, you can find the most recent Java version linked on Oracle’s website. You’ll want the “x64 Compressed Archive”.
After that you’ll have to uncompressed the archive.
tar -xzvf jdk-17_linux-x64_bin.tar.gz
Once you’ve uncompressed the archive you can delete the original tarball.
rm jdk-17_linux-x64_bin.tar.gz
Then you have to tell your shell to use that newly installed version of Java. This is done via the JAVA_HOME
environment variable. You’ll have to set this environment variable differently depending on what shell you’re using.
- If
echo $SHELL
is Bash:
export JAVA_HOME=~/Minecraft/jdk-17.0.2
export PATH=$JAVA_HOME/bin:$PATH
- If
echo $SHELL
is Csh:
setenv JAVA_HOME ~/Minecraft/jdk-17.0.2
setenv PATH $JAVA_HOME/bin:$PATH
You can make the above setting persistent (aka existing after disconnecting and reconnecting via ssh) by adding it to your shell’s rc file.
- If Bash:
echo 'export JAVA_HOME=~/Minecraft/jdk-17.0.2' >> ~/.bashrc
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.bashrc
- If Csh:
echo 'setenv JAVA_HOME ~/Minecraft/jdk-17.0.2' >> ~/.cshrc
echo 'setenv PATH $JAVA_HOME/bin:$PATH' >> ~/.cshrc
You can check your java version with,
java -version
Starting the Server
Finally, we’re almost ready to spin up the Minecraft server. First you have to agree to the licencing agreement. We do that by running the command below.
echo 'eula=true' > eula.txt
Then you can launch the server with the command below.
java -Xmx2048M -Xms2048M -jar server.jar nogui
And there you go, after it generates the world you’ll be able to connect to it through the Minecraft client by going to:
Multiplayer > Direct Connect > USERNAME.pairserver.com > Join Server
Where USERNAME is your pair networks hosting account username. If you have a website with a domain name pointed at the server you should also be able to connect using that domain name.
Additional Tweaks
After starting the server for the first time it is advisable to shut it down again (Ctrl + c) in order to do some final configuration.
After shutting it down you’ll want to edit the newly created server.properties
configuration file.
pico server.properties
There are two changes you’ll want to make to that file. The first is this line.
view-distance=5
Reducing the server’s view distance will help with VPS(s) that might not have enough horse power to load 10 chunks of draw distance. If you’re on dedicated hardware then the view distance can likely be left untouched.
Next it is advisable to enable a “white-list” unless your server is intended to be completely open to the public.
white-list=true
After saving that file, start the server again with the same launch command as mentioned above. Once the server has started type the following into the running game server console, inside of the ssh session.
whitelist add PLAYER_USERNAME
If you try to connect to the server without being whitelisted it will give you
an error until you run the above command. This prevents unauthorized users gaining access to your Minecraft server and griefing your world.
Start / Stop Script
Lastly, if you’d like to make it a little easier to start, stop, and restart your Minecraft server you can use a script I’ve written. Simply download it with curl, make it executable, and then you can use it administer your server.
curl -O https://pairsecrets.com/scripts/minecraft_server.sh
chmod +x minecraft_server.sh
- Start server:
~/Minecraft/minecraft_server.sh start
My script just starts the server in the background in a tmux
session. That way you can disconnect your SSH session and the server will continue running.