Minecraft is a massively popular Java-based game where developers have given users an ability to host multiplayer games relatively easily.
In this guide.
You are going to learn how to set up a Minecraft server in the Pilw.io environment. To have a working server from start to finish, we need to complete following steps:
- Setting up a virtual machine;
- Installing Java;
- Installing Minecraft;
- Let’s start our Minecraft server!
- This tutorial assumes that you have a premium Minecraft user (what it means, is that you have paid for Minecraft).
- You have a Pilw.io Account. If you have problems creating an account, write directly to Pilw.io’s support, which you can find using the Chat bubble at the bottom of the screen.
1. Setting up a virtual machine.
Log in to the pilw.io (https://app.pilw.io) environment.
Once logged in, select the “Compute” tab and then create a new resource by clicking the “New” button.
The following tab will be opened:
Choose type*: – Here you can choose, which type of computing resource you want to create. For this tutorial, we will use “Virtual Machine”.
Choose OS*: – For virtual machines there are many different variations that user can choose from, depending on need. For our case, we are going to select a UNIX based OS, called “Ubuntu”. Also, make sure the version is “18.04”.
Choose size*: – This is where we define the size of our virtual machine. More power means more capability but is also more expensive. Since Minecraft servers are not all alike, you might give your VM more juice.
For our example, we are going to create a Vanilla server and select 1 vCPU, 3GB of ram and 40GB of disk. Since none of those settings are shown as a preset, we are going to use customised bars from the right.
- 1 vCPU – 1 vGPU is just enough for your server. A vanilla Minecraft server won’t use it much as well.
- 4 GB of RAM – 1 GB will be used to run the server and 3 GB is minimum requirements for Minecraft.
- 40GB Disk – This is more than enough to run our server for years. 20 GB of it will be used for OS and another 20 GB for applications like Minecraft.
Good to know – Unique for this platform, resources like vCPU, RAM and DISK are not fixed and can be changed after the VM is already created, as the needs grow.
Billing account*: – This will be selected automatically, if you have a validated account with a working billing account. Without a billing account, you cannot use Pilw.io services. So just select the billing account you would use for your server and you’re good.
*If you have any questions regarding billing, you can always use the Intercom Chat button at the bottom of the screen and ask for support.
Username*: – Give your virtual machine an username. This will be used to log into your virtual machine.
Password*: – Give your machine a password. It is recommended to make it complex enough so it cannot be easily hacked (20+ symbols, small letters, capital letters, numbers and other symbols like #).
SSH*: – “Secure Shell” connection. If you are an SSH user, you can enter your SSH access key, so you can log into your Virtual machine without ever using the password. That way you can disable normal login later on and have a more secure and private way for logging into virtual machine.
Resource name*: – This will be used to display your VM on Pilw.io Environment. It is recommended to use something that always helps you identify the right VM within moments, as you can create not just one but hundreds of VM-s on the Pilw.io platform.
Now you can finally hit “Create”, take a coffee and in 3 minutes, your virtual machine is ready to have the Minecraft server installed on it.
2. Installing Java
You have your machine, but you can’t run the server yet, because the virtual machine doesn’t have the necessary software installed for it to run the server.
Don’t worry, we will go over everything from beginning to the running solution.
To get into your Virtual machine, first select your virtual machine from “Compute”. Once you are in your virtual machine view, click “<> SSH” button”. You can locate it from the top menu of the newly opened tab.
Now Pilw.io’s built in Terminal is shown and you will be asked to log into your virtual machine,
Good to know: If you forget your password, just press the “Change password” button. Match username with existing one and write down a new password.
Once in the terminal window, since connecting for the first time, you will be asked for confirmation if u want to proceed. Type “yes”. After that, “password” will be asked.
Once we are in. We need to make sure our server is up to date. For that we enter:
Sudo apt-get update && sudo apt-get upgrade
Sudo – Gives you ROOT access, that gives you power to do anything on this virtual machine.
Apt-get – Command-line tool which helps in handling packages in Linux.
Update – Checks for updates & Upgrade – Runs those updates.
Somewhere in the process, you will be asked for confirmation about doing the upgrades. Hit “Y” and “Enter”.
Now, it’s time to install Java. For that, enter following command:
sudo apt-get install openjdk-8-jdk-headless
It should ask you to confirm again, so type in “y” and hit enter.
Now, if all went well and it seems like Java finished installing, you can check the Java version with the command:
servername@username:~$ java -version openjdk version "1.8.0_252" OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09) OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
3. Installing Minecraft
First, we need to create a directory for our Minecraft server, just to keep things nice and clean.
Lets go to the directory, using “cd” command
Once in the folder, we need to get a link for our Minecraft install file. For that, we open up the browser (on your personal computer) and go to https://mcversions.net. Here we can choose the server module to our liking. For our case we will use the latest “stable release” and click the “Download” button.
It will take us to the next page, where we can find both Server and Client “Jar” files. We need the link for Server Jar. For that, right click on the button and select “Copy link address”.
Now we will use the “wget” command to download the jar file to our Virtual Machine.
Wget – Command that retrieves content from web servers.
Once wget finishes downloading the file, we can make a few things to make our life a bit easier in the future. One of those things is adding “eula=true” to our eula.txt file.
echo "eula=true" > eula.txt
*Remember to be in the Minecraft folder. If needed, you can confirm that using the “ls” command will list all files in the folder you are currently located.
The next thing we want to do is to create a script that helps us get the server running with one command.
echo “#!/bin/sh” > start.sh
echo “java -Xms1G -Xmx3G -jar server.jar --nogui” >> start.sh
chmod +x start.sh
Echo – Echo inputs content to the target file. If a file does not exist, it will create one.
Chmod – Chmod changes the permissions of a folder or file.
Lastly, we need to enable whitelist on our server and add your Minecraft user to the whitelist and to the operators list.
wget -O - https://publicread.s3.pilw.io/files/minecraft/mc_deploy.sh | bash /dev/stdin <your_username>
Later on, you can add your friends by using command Ingame “/whitelist add <username>”
4. Let’s start our Minecraft server!
For that we need to run the following command:
nohup ./start.sh &
Nohup – tells the terminal to ignore hangup signals, when executing the file. That means, even if you close your browser, the server will stay up & running.
At this point, the server is running and you can log in.
To clarify, the IP you are going to log in with is the same as Public IP of your server. You can get that IP address in many ways. Easiest of them all is probably just going to the User interface of your Virtual Machine and check what is the “Public IP”.
Or if you are still in the terminal, you can just write:
dig +short myip.opendns.com @resolver1.opendns.com
Your Minecraft also uses port 25565 if not changed. So to log in to your server, your login should be something like this: 176.112.XXX.XXX:25565, whereas XXX is representing your IP.
Now your vanilla Minecraft server is set up and you can invite all your friends to play with you and start an adventure together (remember to add them to the whitelist, otherwise they won’t be able to join)!