Learn How To Install a Minecraft Server on Debian 10

November 24, 2019

Table of Contents

If you are using a different system, please check our other tutorials.

Introduction

A Minecraft server will enable you to play Minecraft online with other people. In this article, we are going to install a Minecraft server on Debian 10 (Buster) using An ITWeb.Services instance.

Prerequisites

  • A Debian 10 IT Web Services instance with at least 1 GB of RAM. See the Minecraft Wiki for recommended server requirements based on the number of players.

Step 1 – Install Prerequisite Software

Update the System

First, update the system:

# apt update && apt upgrade -y

Install the Java Runtime Environment

The Minecraft server is written in Java. The Java Runtime Environment normally requires a graphical interface and extra dependencies. However, since we are using a console-only environment, the lightweight, headless (non-graphical) version can be used:

# apt install openjdk-11-jre-headless -y

Install Screen (Optional)

Screen allows the server to run in the background.

# apt install screen -y

Step 2 – Add a Separate User for the Server

For security reasons, it is preferable to run the Minecraft server as a non-root user. Create a new non-root user named mcuser:

# adduser mcuser

Add mcuser to the sudo group:

# usermod -aG sudo mcuser

Switch to the new user account:

# su - mcuser

Step 3 – Install the Minecraft Server

Create a new directory for Minecraft

Create a new directory to hold the Minecraft data:

$ mkdir minecraft

Change to the new directory:

$ cd minecraft

Download the Server

Download the server Java executable with wget. Replace the URL below with the download link on the Minecraft.net download page.

$ wget https://launcher.mojang.com/[NEWEST_VERSION]/server.jar

Run the Server

Accept the license agreement (required to run the server):

$ echo "eula=true" > eula.txt

Start the server:

$ java -Xmx1024M -Xms1024M -jar server.jar nogui

This command allocates 1024MB of RAM to the server. To allocate more RAM, change the -Xmx and -Xms parameters. For example, -Xmx2048M -Xms2048M will start the server with 2048MB of RAM.

Run Server in Background with Screen (optional)

GNU Screen is a terminal multiplexer that allows software to be run in the background. To run the server in the background, first stop the currently running server by typing stop and pressing ENTER (there may be a little waiting before it exits). Then, create a new screen instance:

$ screen -S "My Minecraft Server"

Now, rerun the Java command:

$ java -Xmx1024M -Xms1024M -jar server.jar nogui

To exit out of screen, press CTRL + A, then press D. To reconnect to screen, use the command screen -r.

Conclusion

Congratulations, you now have a Minecraft server installed on Debian 10.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!