How to Install Minecraft Server on Debian 9

Install Minecraft Server on Debian 9

In this article, we will have explained the necessary steps to install and configure Minecraft Server on Debian 9. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Minecraft is one of the most popular games of all time. It is a sandbox video game about building various structures and going on adventures.

Install Minecraft Server on Debian 9

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade

Step 2. Install Java Runtime Environment.

Install the required dependencies. You will need at least Java 7, but Java 8 is HIGHLY recommended. OpenJDK is fine:

sudo apt install openjdk-8-jre-headless

Verify the installation by printing the java version:

java -version

Step 3. Creating Minecraft User.

The next step is to create a new system user and group with home directory /opt/minecraft that will run the Minecraft server:

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

Step 4. Install Minecraft on Debian.

First, before starting with the installation process, make sure you switch to minecraft user:

sudo su - minecraft

Now create three new directories inside the user home directory:

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.

Then, Downloading and Compiling mcrcon.

Start by navigating to the ~/tools directory and clone the Tiiffi/mcrcon repository from GitHub using the following command:

cd ~/tools && git clone
cd ~/tools/mcrcon
gcc -std=gnu11 -pedantic -Wall -Wextra -O2 -s -o mcrcon mcrcon.c
./mcrcon -h

Next steps, downloading Minecraft Server.

wget -P ~/server

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

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

When the server is started for the first time it executes some operations and creates the and eula.txt files and stops:

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

As you can see from the output above you’ll need to agree to the Minecraft EULA in order to run the server. Open the eula.txt file and change eula=false to eula=true:

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 2019

Next, enable the rcon protocol and set the rcon password by editing the file. You can use these details to connect to the Minecraft server using the mcrcon tool:

nano ~/server/

Step 5. Creating Systemd Unit File Minecraft.

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

sudo nano /etc/systemd/system/minecraft.service
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


Start and enable the Minecraft server by executing:

sudo systemctl daemon-reload
sudo systemctl start minecraft
sudo systemctl enable minecraft

Step 6. Configure firewall

If your server is protected by a firewall and you want to access Minecraft server from the outside of your local network you need to open port 25565:

sudo ufw allow 25565/tcp

Step 7. Accessing Minecraft Console.

To access the Minecraft Console you can use the mcrcon utility. 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 Your-password -t

Congratulation, you have learned how to install and configure Minecraft on Debian 9 Stretch. If you have any question, please leave a comment below.