Black Friday this year brought some really good deals on VPS’s, especially if you were looking for a yearly term. I was able to pick up a 2 Core/512MB/50GB VPS from Virmarch for $10/year. It was too good of a deal to pass up. But once I got the server, I needed to decide what I would do with it. The specs were really too low to use for a web server. Then I remembered that my son was wanting a Minecraft Server so he could play Minecraft online with his friends. This server would perfectly for Minecraft, it had a 500GB bandwidth cap, which should be plenty for a few kids to use. So I set out to document a Minecraft Server Setup.
Minecraft Server Setup
I’ll walk through the steps needed to get your Minecraft server running. Depending on what was on your server image, some of these steps may not be needed. But there’s no harm in running them again. My VPS was pretty bare bones, so I had to do all of this.
First install the software-properties-common library, this is needed so you can add a custom repository for OpenJDK.
sudo apt-get install software-properties-common
Now run the following command to add the OpenJDK/ppa repository. This will enable you to install the Java Development Kit, which is pretty much your only requirement for running Minecraft server.
sudo add-apt-repository ppa:openjdk-r/ppa
You can now proceed with installing Java on the VPS.
sudo apt-get update sudo apt-get install openjdk-7-jdk
Next setup a directory for your Minecraft Server software on the VPS. Note, these is for Minecraft 1.11. If you want to use a different version in your Minecraft Server Setup you just need to download that version’s jar file to the server.
mkdir /opt/minecraft cd /opt/minecraft wget https://s3.amazonaws.com/Minecraft.Download/versions/1.11/minecraft_server.1.11.jar
Make the jar file executable.
chmod +x minecraft_server.1.11.jar
You can now launch Minecraft, but the first time you start the server it will stop and ask you to accept the EULA. Run the following to do the initial launch.
java –Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
Edit the eula.txt so that it looks like this
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula). #Fri Nov 25 21:49:02 EST 2016 eula=TRUE
I created a bash script to make it little easier to launch the server. It changes the memory usage to be a little lower and also launches using setsid so that Minecraft will keep running if my session closes. Save this as start-mc.sh in your Minecraft directory.
cd /opt/minecraft setsid java -Xmx512M -Xms512M -jar /opt/minecraft/minecraft_server.1.11.jar nogui
Your Minecraft Server Setup is complete, run /opt/minecraft/start-mc.sh to launch the server again. Minecraft will generate all the game files needed inside of /opt/minecraft.
Most of the Minecraft settings can be tweaked using the server.properties file.
If you have a DNS name you can use that as well. It should connect pretty quickly. You can then connect into the game. Happy Blocking!!