Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Install Minecraft Server on Ubuntu 20.04 – A detailed guide

by | Feb 20, 2021

Install Minecraft Server on Ubuntu? We can help you.

Minecraft is one of the most popular games of all time. It is a sandbox video game where players explore infinite worlds and build different structures from simple houses to towering skyscrapers.

As part of our Server Management Services, we assist our customers with several Ubuntu queries.

Today, let us discuss how to install Minecraft Server on Ubuntu 20.04


Install Minecraft Server on Ubuntu 20.04?

In this article, let us see how to make a Minecraft Server on Ubuntu 20.04 and how to create a cronjob that performs regular server backups.

We use Systemd to run the Minecraft server and the mcrcon utility to connect to the running instance.

In order to begin our Support Techs recommend having 4GB of RAM as a minimum configuration for a typical setup.

In addition, install the packages required to build the mcrcon tool:

$ sudo apt update
$ sudo apt install git build-essential


  • Install Java Runtime Environment

Since Minecraft requires Java 8 or higher and does not need a graphical user interface, so let us install the headless version of Java.

We run the following command to install the headless OpenJRE 11 package:

$ sudo apt install openjdk-11-jre-headless

We can verify the installation by printing the Java version:

$ java -version
openjdk version “11.0.7” 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)


  • Create Minecraft User

For security reasons, we should not run Minecraft under the root user. We will create a new system user and group with a home directory /opt/minecraft with minimum necessary permissions to run the Minecraft server:

$ sudo useradd -r -m -U -d /opt/minecraft -s /bin/bash minecraft

Since we do not set a password for this user login via SSH is not possible and cannot compromise.


  • Install Minecraft on Ubuntu

Before we start with the installation process, we switch to the Minecraft user:

$ sudo su – minecraft

To create three new directories inside the user home directory we run:

$ mkdir -p ~/{backups,tools,server}


  • Download and Compile mcrcon

RCON is a protocol that allows us to connect to the Minecraft servers and execute commands. mcron is an RCON client written in C.

We can download the source code from GitHub and build the mcrcon binary.

Clone the Tiiffi/mcrcon repository from GitHub to the ~/tools/mcron directory:

$ git clone ~/tools/mcrcon

Once done, switch to the mcron directory and build the utility:

$ cd ~/tools/mcrcon
$ gcc -std=gnu11 -pedantic -Wall -Wextra -O2 -s -o mcrcon mcrcon.c

Then, verify that mcrcon has been successfully compiled by printing its version:

$ ./mcrcon -v

Our output will be like this:

mcrcon 0.7.1 (built: Jun 23 2020 15:49:44) –
Bug reports:
tiiffi+mcrcon at gmail


  • Download Minecraft Server

Craftbukkit or Spigot is Minecraft servers that allow us to add features (plugins) on our server and further customize and tweak the server settings.

However, our Support Techs will install the latest Mojang’s official vanilla Minecraft server.

We can get the download link of the latest Minecraft server’s Java archive file (JAR) from the Minecraft download page.

We download the jar file in the ~/server directory with wget:

$ wget -P ~/server


  • Configure Minecraft Server

After the download, switch to the ~/server directory and start the Minecraft server:

$ cd ~/server
$ java -Xmx1024M -Xms1024M -jar server.jar nogui

For the first time, the server executes some operations, creates the and eula.txt files, and stops.

[17:35:14] [main/ERROR]: Failed to load properties from file:
[17:35:15] [main/WARN]: Failed to load eula.txt
[17:35:15] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.

As indicated, to run the server, we need to agree to the Minecraft EULA. Open the eula.txt file and change eula=false to eula=true:

$ nano ~/server/eula.txt

Close and save the file.

Next, open the file and enable the rcon protocol and set the rcon password:

$ nano ~/server/

Locate the following and update their values, as shown below:


Make sure to change the strong-password to something more secure. If we do not want to connect to the Minecraft server from remote locations, we have to block the rcon port by the firewall.


  • Create Systemd Unit File

Instead of manually starting the Minecraft server, we will create a Systemd unit file and run Minecraft as a service.

For that, we need to switch back to sudo user by typing exit.

Open the text editor and create the file minecraft.service in the /etc/systemd/system/ directory:

$ sudo nano /etc/systemd/system/minecraft.service

Then paste the following configuration:

Description=Minecraft Server

SuccessExitStatus=0 1
ExecStart=/usr/bin/java -Xmx1024M -Xms1024M -jar server.jar nogui
ExecStop=/opt/minecraft/tools/mcrcon/mcrcon -H -P 25575 -p strong-password stop


Modify the Xmx and Xms flags according to our server resources. Also, make sure to use the correct rcon port and password.

Eventually, save the file and reload the systemd manager configuration:

$ sudo systemctl daemon-reload

To start the Minecraft server we run:

$ sudo systemctl start minecraft

The first time we start the service, it will generate several configuration files and directories, including the Minecraft world.

Check the service status with the following command:

$ sudo systemctl status minecraft
● minecraft.service – Minecraft Server
Loaded: loaded (/etc/systemd/system/minecraft.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2020-06-23 17:48:44 UTC; 8s ago
Main PID: 1338035 (java)
Tasks: 15 (limit: 1074)
Memory: 465.3M
CGroup: /system.slice/minecraft.service
└─1338035 /usr/bin/java -Xmx1024M -Xms1024M -jar server.jar nogui

Finally, enable the Minecraft service to automatically start at boot time:

$ sudo systemctl enable minecraft


  • Adjust Firewall

Ubuntu ships with a firewall configuration tool called UFW.

We need to open port 25565 if the firewall is enabled on our system and want to access the Minecraft server from the outside of our local network:

$ sudo ufw allow 25565/tcp


  • Configure Backups

Moving ahead, let us create a backup shell script and cronjob to automatically backup the Minecraft server.

We switch to Minecraft:

$ sudo su – minecraft

Open the text editor and create the following file:

$ nano /opt/minecraft/tools/

Then paste the following configuration:


function rcon {
/opt/minecraft/tools/mcrcon/mcrcon -H -P 25575 -p strong-password “$1”

rcon “save-off”
rcon “save-all”
tar -cvpzf /opt/minecraft/backups/server-$(date +%F-%H-%M).tar.gz /opt/minecraft/server
rcon “save-on”

## Delete older backups
find /opt/minecraft/backups/ -type f -mtime +7 -name ‘*.gz’ -delete

Save the file and make the script executable:

$ chmod +x /opt/minecraft/tools/

Then, we create a cron job that will run once a day at a fixed time.

Open the crontab file:

$ crontab -e

Then, to run the backup script every day at 23:00, paste the following line:

0 23 * * * /opt/minecraft/tools/


  • Access Minecraft Console

To access the Minecraft Console, we use the mcrcon utility. We need to specify the host, rcon port, rcon password and use the -t switch which enables the mcrcon terminal mode:

$ /opt/minecraft/tools/mcrcon/mcrcon -H -P 25575 -p strong-password -t
Logged in. Type “Q” to quit!

While accessing the Minecraft Console from a remote location, make sure the rcon port is not blocked.

If we are regularly connecting to the Minecraft console, instead of typing this long command, we can create a bash alias.

[Stuck with the installation? We’d be happy to assist you]



To conclude, we discussed how our Support Techs install a Minecraft server on Ubuntu 20.04 and set up a daily backup. We can now launch the Minecraft client, connect to the server and start Minecraft adventure.


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.


var google_conversion_label = "owonCMyG5nEQ0aD71QM";


Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center


Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]


Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid


Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie


These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.