0

I plan to run 2 minecraft servers:

  1. 1.15.2 Vanilla (Running fine with Java 11)

  2. 1.10.2 Modded (Not able to give the correct version to the Terminal) I have Java8 installed alongside Java11 but Im not sure of the command to run Java8 for the 1.10.2 server like it's required.

(i.e. "java -version"8" doesnt work like it would on old Archlinux versions, not sure the Ubuntu version.)

2
  • Are you open to using containers? That would make the separation very easy. – user535733 Apr 25 '20 at 23:28
  • To be honest I'm very new to Linux and only using it as a way to bypass the system usage windows has for Minecraft servers on this rig. Not sure what Containers are or how to use them, but if it helps this scenario Im open to learning. – Anon Sunny Apr 26 '20 at 7:17
0

Here's one way, using LXD Containers (this is how I do it). This is not the only way, and what might work best for you may be different than what works best for me. I'm moderately skilled at this stuff; coming at this new to containers, networking, package management, and systemd would take a couple days of learning.

Containers use Kernel features to behave quite like a Virtual Machine (VM) - a container feels like a separate machine, but with surprisingly little overhead resource cost. You can use containers to isolate different versions of applications (like Java) without affecting your host system, and to host different network services. Containers are not real VMs, and containers are not perfect...but they can be very handy.

  1. Planning. You will need around 15GB (total) for the containers.

  2. Install and set up the lxd snap. Very good tutorial and example.

  3. Create a test container. Take a couple minutes to practice starting and stopping it, creating and destroying it, figuring out it's IP address, and how to get shell access within the container. Also figure out how to autostart a container at host boot.

  4. Create two containers. Get shell access inside each. Install the appropriate Java and Minecraft Server into each container. Depending upon the version of Java you need, your containers might be using two different releases of Ubuntu! Install whatever release of Ubuntu includes the correct version of Java that you need. DON'T install the newest Ubuntu and then try to mangle the system to make a different Java fit. DON'T install Java from a non-Ubuntu source.

  5. [OPTIONAL] Edit the LXD networking profile to get IP addresses from your router instead of a host-internal NAT. This means you only need to port forward once (at the router) and keeps your network simpler. Each container will have a separate IP address. Set up the port forwarding on your router for both containers.

  6. Set up systemd services within each container to start and stop the minecraft server. This will start the minecraft server at container-start (boot), and gracefully stop the server at container-stop (shutdown). I prefer this over the typical screen hacks. All Minecraft Server output is logged anyway, so you can read it anytime.

  7. Finally, figure out how you want to backup your Minecraft worlds. You can simply export a copy of the entire container to whatever your backup scheme is (warning: it's big). Or your can use the lxc pull command to merely grab the /home/minecraft directory where all the data is.

NOTE: Lots of folks make mistakes with their first container. That's okay. Keep notes on what you did and why so you can maintain it, improve it, and remake it better next time.

That seems like a lot of setup. However, it has a lot of benefits: Each Minecraft Server is fully sandboxed from the host system and from the other server. Different IP addresses, different everything...but easy control, monitoring, and troubleshooting for you. This setup uses built-in features of Ubuntu: Package management, automatic security upgrades, systemd control and monitoring.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.