Managing A Simple Family Minecraft Server
In short, I use my ratcraft script to manage a Minecraft server in the "cloud".
Virtual hardware
I have an Linode shared virtual instance that has the following specs: 4GB RAM, 2 Cores, 80 GB SSD, and a price of $20 per month. Although cheaper instances might work, we've had no issues with more than four people using this instance.
Hosting on an in-house computer is great and would cost less after one year. However, having a "cloud" instance is much easier to manage and easier to connect with friends outside the house.
The server runs Slackware Linux, and I manage the server through SSH.
I also gave it a DNS subdomain, making it easy to tell friends how to get it.
Minecraft Server
We've played around with mods (and creating them), so we've run Spigot servers locally. On the server for our family we have the "vanilla" Minecraft server (Java Edition).
Launching the server
The server is a Java executable that must be maintained running as a process. I've opted to manage the process by using the GNU terminal multiplexer screen. This is the start command.
Naturally, I'm not going write that more than once, so I wrote an application (a tiny Bash script) to do this for me called ratcraft.
It's around 130 lines of Bash and has a handful of commands:
Server upgrades
The Minecraft clients automatically update to the latest version the moment it's released.
Getting the latest server to match is as simple as grabbing the tarball link from minecraft.net/download/server and downloading it on the host:
Update: I no longer manually rename the server to the version number and keep the old ones around. Instead I let the server.jar that I downloaded server.jar overwrite the previous version. This saves me a step, and I've never had a need to downgrade (yet).
So I no longer do this step: manually edit the script of ratcraft to update the server version:
Then, I just restart the server (stop and start) with the ratcraft program.
In just a few minutes, the server is ready to receive the latest clients in a matter of minutes.
While it's not a commercial-grade solution this is:
Easy enough to be understood when I revisit it every couple of months
- Automated enough to not be a total pain to use
Backups
The ratcraft script has the ability to backup. I call it every day via the cron job that is located in Slackware's /etc/cron.daily directory. The script simply calls:
The backup tells the Minecraft server to stop saving, and creates a .tgz by using tar -cpvzf in the "world" directory and saves it in the "backups" directory.
The backup command also runs a simple backup rotation so the server doesn't get overloaded. Sometimes, we want to keep a crucial moment in our world. To accomplish this, I simply rename one backup to ensure it doesn't get removed from the rotation.
Upgrade or Getting the JDK
You could just run the Java executable from your system and then update with the package manager. Minecraft-servers.fun But in my universe it's more manual.
The Minecraft server updates seem to require newer and more recent versions of the JVM. I'm not up to speed with the Java world at all any more however, it appears that the best source to download the JVM is:
http://jdk.java.net/
I don't think you'll be able to locate the JRE (runtime environment ) without JVM) which is all you require to run the Minecraft server. It's not a huge deal. The JDK is a larger download as it comes with an enhanced version of the JRE along with compilers and libraries.