Table of contents
Minecraft is a playground video game that helps determine completely random landscapes and build spectacular constructions ranging from tiny houses to massive castles. It was created by Mojang Studios and eventually purchased by Microsoft. Most computer video games from a decade ago are collecting dust on shelves, but Minecraft is still going strong. It is a three-dimensional video game in which players build and destroy various types of blocks. Survival and Creative are the game’s two main modes.
Players in Survival must gather their building materials and food. They also interact with moving creatures and blocklike mobs. While players in Creative are provided materials and do not need to eat to survive. The only job in creative mode is constructing. They can also instantly break any block.
Minecraft is compatible with a variety of operating systems. This tutorial shows you how to install Minecraft on CentOS, Ubuntu, or Windows in the AWS cloud.
Launching EC2 instance
For more information about launching an EC2 instance in the AWS cloud, review the Launch an instance using the Launch Instance Wizard guide.
Choose an AMI
Choose the required AMI image with the operating system of your choice (Ubuntu, CentOS or Windows).
Choose an Instance Type
Use the following official server requirements table, to choose the right EC2 instance type.
For the purpose of this demo, we’ll choose the minimal instance type for our server – t2.micro
.
Choose a VPC
Next we have to configure VPC details.
Use default VPC settings at this step.
Choose a Storage
Again, use the official server requirements table to get an idea, how much storage you need.
We’ll move forward with 30 GiB gp2 EBS volume.
Add Tags
To be able to easily identify your server, add Tag with the following parameters:
- Key –
Name
- Value –
minecraft-server
Security Group
Security Group is an EC2 instance firewall.
It allows you to protect your server from unwanted connections.
In addition to the default SSH or RDP port, you need to open TCP/25565
to allow connections to your Minecraft server.
For Ubuntu and CentOS, use the following Security Group configuration.
For Windows, configuration is a little bit different.
Review and launch
Review and launch your EC2 instance by pressing Launch button.
AWS will ask you to choose your SSH key (for more information about using SSH, check out the Top 10 SSH Features You MUST Know To Be More Productive article).
Use your existing SSH key or if you do not have any, choose Create New SSH Keypair and download it.
Elastic IP
By default, AWS will provide a random public IP-address for your EC2 instance, which will be changed if you stop and start EC2 instance.
If you’d like to have a constant dedicated static IP-address, you have to use Elastic IP.
In your EC2 console, choose Elastic IPs.
Click Allocate Elastic IP address button.
You may proceed with default settings.
Click Allocate button.
Next, we need to associate obtained public IP-address with the EC2 instance.
Choose your EC2 instance from the list and click Associate button.
Now, you can use this static IP-address to connect to your Minecraft server.
Setting up Minecraft server on CentOS
SSH to your Minecraft server using centos
as a hostname.
Before installing a new package, update your system packages:
sudo yum update -y
Now, install the Java on CentOS by running the command:
sudo yum install java -y
Check the installed version by typing the command:
java -version
To install tmux
utility, use the following command:
sudo yum install tmux -y
Install wget
to download new packages:
sudo yum install wget -y
Create a minecraft
folder and jump into it:
mkdir minecraft
cd minecraft
Copy and paste the command in the terminal to download the Minecraft server properties file:
wget https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar
Do not pay attention to the errors and execute the following commands to extract the properties and EULA files:
java -Xmx1024M -Xms1024M -jar server.jar nogui
Use the nano
editor to accept the Minecraft EULA license agreement:
nano eula.txt
Change eula value to true:
The easiest way to run Minecraft server in the background is by using Tmux (for more information about Tmux, check our article How To Start Using Tmux Like A Pro In 5 Minutes).
To run Minecraft server in the background, you need to run the tmux
command first:
tmux
Now, run the Minecraft server:
java -Xmx1024M -Xms1024M -jar server.jar nogui
It will take up to a couple of minutes to launch the server completely.
To detach from the Tmux session press Ctrl+b then press d.
To reopen the Tmux session, type:
tmux attach -t 0
Setting up Minecraft on Ubuntu
SSH to your Minecraft server using ubuntu
as a hostname.
Before installing any new packages, it is good to update package repositories:
sudo apt update
Now, install the Java on Ubuntu by running the command:
sudo apt-get -y install default-jdk
Check the Java version:
java -version
Create a directory minecraft
and jump there.
mkdir minecraft
cd minecraft
Copy and paste the command to get Minecraft server file:
wget https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar
Use the following command to run Minecraft server:
java -Xmx1024M -Xms1024M -jar server.jar nogui
During the first run command will exit with the following errors:
- [main/ERROR]: Failed to load properties from file: server.properties
- [main/WARN]: Failed to load eula.txt
- [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
But at the same time it will create all required files.
Use the nano
editor to accept the Minecraft EULA agreement:
nano eula.txt
Change eula value to true:
The easiest way to run Minecraft server in the background is by using Tmux (for more information about Tmux, check our article How To Start Using Tmux Like A Pro In 5 Minutes).
To run Minecraft server in the background, you need to run the tmux
command first:
tmux
Now, run the Minecraft server:
java -Xmx1024M -Xms1024M -jar server.jar nogui
It will take up to a couple of minutes to launch the server completely.
To detach from the Tmux session press Ctrl+b then press d.
To reopen the Tmux session, type:
tmux attach -t 0
Install Minecraft server on Windows
Use RDP to connect to you Windows 2019 EC2 instance, launch PowerShell and install Chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Install Java using the following command.
choco install javaruntime
Open Windows Command Line interface by typing cmd
and check installed Java version:
java -version
Install Google Chrome browser:
choco install googlechrome
Now, in the Google Chrome browser download the Minecraft server from the official website: Minecraft Server Download | Minecraft.
Save “minecraft_server 1.16.5 jar” to the C:\minecraft
folder:
In the Windows Command Line go to C:\minecraft folder and launch the server:
cd C:\minecraft
java -Xmx1024M -Xms1024M -jar server.jar nogui
In File Explorer open C:\minecraft
folder and edit eula.txt
file.
Change eula
value to true
.
Now, run the Minecraft server in Windows Command Line interface once more again:
java –Xmx1024 –Xms1024M –jar srver.jar nogui
Wait a couple of minutes while server is starting.
Windows Firewall configuration
By default, Windows EC2 instance has Windows Defender (firewall) enabled, which will prevent connections to your Minecraft server.
To enable connections to the server, launch wf.msc
:
Click to Incoming Rules and then New Rule action.
Choose Port configuration.
Specify port TCP/25565
.
Choose Allow the connection from the list.
Enable the following networks:
- Domain
- Private
- Public
Add the rule Name, for example, Minecraft server
.
Now you’ll be able to connect to your Windows Minecraft server.
Testing Minecraft server
Install Minecraft client or use already existing one.
Now, add Minecraft server IP-address by clicking on the “Multiplayer” button.
Then, click “Add server” button add server.
Enter your Minecraft server name and Server IP address and click Done button to connect to the server.
Wait a couple of moments to connect with the server:
Once the server is connected, you are ready to play the game:
Potential issues
Lack of server resources
If you’re facing the following errors:
- [Server thread/WARN]: Can’t keep up! Is the server overloaded? Running 11361ms or 227 ticks behind
- [Server Watchdog/FATAL]: A single server tick took 64.97 seconds (should be max 0.05)
- [Server Watchdog/FATAL]: Considering it to be crashed, server will forcibly shutdown.
You need to increase Minecraft server CPU and RAM resources by switching to a bigger instance type.
Conclusion
Minecraft is a sandbox video game that allows you to explore randomly generated landscapes and construct magnificent structures ranging from modest houses to massive castles. It was created by Mojang Studios and eventually purchased by Microsoft. Minecraft runs on different operating systems. In this write-up, we have demonstrated how to set up a Minecraft server on Ubuntu, CentOS, and Ubuntu. This guide will walk you through the process of setting up a Minecraft server on your preferred platform.
Related articles
- How to install Minecraft client on Ubuntu
- How To Start Using Tmux Like A Pro In 5 Minutes
- What Is Hypervisor And What Are Its Types
- The Best Linux Distribution for your next cloud server
- How to use CURL like a Pro in Linux
I’m a passionate Cloud Infrastructure Architect with more than 15 years of experience in IT.
Any of my posts represent my personal experience and opinion about the topic.