How to Install Minecraft Server on Debian 9

Install Minecraft Server Minecraft is one of the maximum famous video games of all time. It is a sandbox online game approximately constructing diverse structures and occurring adventures.

This educational explains a way to installation and configure Minecraft Server on Debian nine. We’ll use Systemd to run the Minecraft server and the mcrcon software to hook up with the jogging example. We’ll also display you a way to create a cronjob a good way to perform everyday server backups


The user you are logged in as need to have sudo privileges.

Install the programs required to construct the mcrcon device:

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

Installing Java Runtime Environment

Minecraft requires Java eight to be installed on the gadget. We’ll set up the headless model of the JRE. This model is more appropriate for server packages because it has fewer dependencies and makes use of much less gadget resources:

$ sudo apt install openjdk-8-jre-headless

Verify the installation by walking:

$ java -version

out put

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b01-1~deb9u1-b01)
OpenJDK 64-Bit Server VM (build 25.212-b01, mixed mode)

Creating Minecraft User

Install Minecraft Server The subsequent step is to create a new machine user and group with domestic listing /opt/minecraft to be able to run the Minecraft server. To do so run the subsequent command:

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

The person will have no password. This is ideal security practice due to the fact this person will not be able to login thru SSH.

Installing Minecraft on Debian

Before starting with the installation manner, ensure you turn to minecraft consumer.

$sudo su - minecraft

Create 3 new directories inside the person home listing:

$mkdir -p ~/{backups,tools,server}
  • The backups directory will store your server backup. You can later synchronize this directory to your remote backup server.
  • The tools directory will be store the mcrcon client and the backup script.
  • The server directory will contain the actual Minecraft server and its data

Downloading and Compiling mcrcon

RCON is a protocol that allows you to hook up with the Minecraft servers and execute commands. Mcron is RCON customer constructed in C. We’ll download the supply code from GitHub and construct the mcrcon binary.

Start through navigating to the ~/gear directory and clone the Tiiffi/mcrcon repository from GitHub the usage of the following command:

$cd ~/tools && git clone

Switch to the repository listing:

$ cd ~/tools/mcrcon

Start the compilation of the mcrcon application by way of running:

$ gcc -std=gnu11 -pedantic -Wall -Wextra -O2 -s -o mcrcon mcrcon.c 

Once completed, you may check it by way of typing:

$./mcrcon -h

The output will appearance something like this:

Downloading Minecraft Server

Install Minecraft Server There are several Minecraft server mods like Craftbukkit or Spigot that lets in you to feature capabilities (plugins) in your server and further customise and tweak the server settings. In this tutorial, we will deploy the brand new Mojang’s legitimate vanilla Minecraft server. The contemporary Minecraft server’s Java archive report (JAR) is variable for down load from the Minecraft down load page.

At the time of writing, the present day version is 1.13.2. Before continuing with the following step you must test the download page for a new version.

Run the subsequent wget command to download the Minecraft jar document within the ~/server directory:

$wget -P ~/server

Configuring Minecraft Server

Once the download is completed, navigate to the ~/server directory and begin the Minecraft server:

$cd ~/server
$java -Xmx1024M -Xms512M -d64 -jar server.jar nogui

When the server is began for the primary time it executes some operations and creates the server.Homes and eula.Txt files and forestalls.

out put

[14:47:54] [main/INFO]: Loaded 0 recipes
[14:47:54] [main/INFO]: Loaded 0 advancements
[14:47:54] [Server thread/INFO]: Starting minecraft server version 1.13.2
[14:47:54] [Server thread/INFO]: Loading properties
[14:47:54] [Server thread/WARN]: does not exist
[14:47:54] [Server thread/INFO]: Generating new properties file
[14:47:54] [Server thread/WARN]: Failed to load eula.txt
[14:47:54] [Server thread/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
[14:47:54] [Server thread/INFO]: Stopping server
[14:47:54] [Server thread/INFO]: Saving worlds
[14:47:54] [Server Shutdown Thread/INFO]: Stopping server
[14:47:54] [Server Shutdown Thread/INFO]: Saving worlds

As you could see from the output above you’ll want to agree to the Minecraft EULA that allows you to run the server. Open the eula.Txt record and change eula=fake to eula=genuine:

$ nano ~/server/eula.txt


#By changing the setting below to TRUE you are indicating your agreement to our EULA (
#Thu Dec 27 03:33:56 PST 2018

Close and shop the document. Next, allow the rcon protocol and set the rcon password by editing the server.Houses report. You can use these information to hook up with the Minecraft server the usage of the mcrcon device.

$ nano ~/server/



NOTE: Do not forget to change the strong-password to something more secure. Alternatively, you can specify another port. If you don’t want to connect to the Minecraft server from remote locations make sure the rcon port is blocked by your firewall.

You can also modify the server’s default houses. For extra records approximately the viable settings go to the server.Residences web page

Creating Systemd Unit File

Switch again for your sudo user by using typing go out.

Open your text editor and create a document named minecraft.Provider within the /and many others/systemd/device/:

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

Paste the following configuration:


Description=Minecraft Server

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


Modify the Xmx and Xms flags in keeping with your server assets. The Xmx flag defines the maximum memory allocation pool for a Java virtual system (JVM), whilst Xms defines the initial memory allocation pool. Also, make certain which you are using the suitable rcon port and password.

Save and close the file and notify systemd that we created a new unit file:

$sudo systemctl daemon-reload

Start and enable the Minecraft server by executing:

$sudo systemctl start minecraft
$sudo systemctl enable minecraft

The first time you begin the service it will generate numerous configuration documents and directories inclusive of the Minecraft global.

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 Sun 2019-03-31 14:55:19 PDT; 28s ago
 Main PID: 7262 (java)
    Tasks: 19 (limit: 4915)
   CGroup: /system.slice/minecraft.service
           └─7262 /usr/bin/java -Xmx1024M -Xms512M -jar server.jar nogui --noconsole

Adjusting Firewall

If your server is protected by using a firewall and you want to get entry to Minecraft server from the outside of your local community you need to open port 25565.

To allow traffic on the default Minecraft port 25565 kind the following command:

$ sudo ufw allow 25565/tcp

Configuring Backups

In this segment, we’ll create a backup shell script and cronjob to mechanically backup the Minecraft server.

Start via switching to minecraft user: $ sudo su – minecraft

Open your text editor and create the following file:

$ nano /opt/minecraft/tools/

Paste the following configuration:


function rcon {
  /opt/minecraft/tools/mcrcon/mcrcon -H -P 23888 -p strong-password "$1"

rcon "save-off"
rcon "save-all"
tar -cvpzf /opt/minecraft/backups/server-$(date +%F_%R).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 it executable:

$ chmod +x /opt/minecraft/tools/

Next, create a cron activity that will run as soon as in an afternoon robotically at a set time.

Open the crontab file by typing:

$ crontab -e

To run the backup script each day at 23:00 paste the following line:

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

Accessing Minecraft Console

To access the Minecraft Console you may use the mcrcon software. The syntax is as follows, you 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 23888 -p strong-password -t

OUT PUT Logged in. Type "Q" to quit!

To get admission to the Minecraft Console from a far flung region make sure the rcon port isn’t blocked. If you are often connecting to the Minecraft console, rather than typing this lengthy command you can create a bash alias