How to Install a Minecraft Server on Debian 11

Updated on March 23, 2022
How to Install a Minecraft Server on Debian 11 header image


By setting up a Minecraft server, you get the power to create and control your own Minecraft worlds. This article explains how to install Minecraft Java Edition server 1.18.2, the latest version of Minecraft Java Edition server for now, on a Debian 11 Bullseye cloud server at Vultr from scratch.


Before diving in, you need to:

  • Deploy a Debian 11 server instance at Vultr near your location with at least 2 GB of memory, which is suitable for hosting up to 10 players with some basic plugins or mods. This article uses as an example IP address.

1. Harden the System

Open your favorite SSH client on your desktop machine, such as PuTTY on Windows, and then log in to your server instance as root with the initial password you found on the Server Details page.

After logging in, execute the following tasks to harden the system.

Find out if any swap file or swap partition is in use:

# swapon -s

If so, feel free to go to the next task. Otherwise, set up a swap file of 2GB to smooth system operations:

# fallocate -l 2g /swap
# chmod 0600 /swap
# mkswap /swap
# swapon /swap
# echo '/swap    none swap defaults 0 0' | tee -a /etc/fstab
# free -m

Change the initial root password to a private and strong one, such as r00tyHvM%2ka$8E3:

# echo 'root:r00tyHvM%2ka$8E3' | chpasswd && history -d -1

Create a non-root user account with sudo privileges, such as mcninja, and then also set up a strong password for it, such as sud04QeXbcx#6&Cw:

# useradd -ms /bin/bash mcninja
# echo 'mcninja:sud04QeXbcx#6&Cw' | chpasswd && history -d -1
# echo 'mcninja    ALL=(ALL)   NOPASSWD: ALL' | tee -a /etc/sudoers.d/designated
# chmod 0440 /etc/sudoers.d/designated

Setup UFW firewall rules to allow only traffic on SSH (22) and the default Minecraft (25565) ports:

# ufw default deny
# ufw allow 22
# ufw allow 25565
# ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y:key_enter:
# ufw status verbose

Update the system, and then reboot:

# apt update
# apt upgrade -y
# apt autoremove -y
# shutdown -r now

After the server instance gets up and running again, log in as the newly created sudo user mcninja for the following tasks.

2. Install the Temurin 17 OpenJDK Distribution

Minecraft Java Edition server 1.18.2 requires Java 17. Among various Java 17 distributions, this article chooses to install Temurin (the continuation of AdoptOpenJDK) 17 OpenJDK binaries from Eclipse Adoptium.

Make sure required packages are in place:

$ sudo apt install wget apt-transport-https -y

Download the Eclipse Adoptium GPG key for package verification:

$ wget -O - | sudo tee /usr/share/keyrings/adoptium.asc

Setup the Eclipse Adoptium Advanced Packaging Tool (APT) repository:

$ echo "deb [signed-by=/usr/share/keyrings/adoptium.asc] $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list

Install Temurin 17 OpenJDK:

$ sudo apt update
$ sudo apt install temurin-17-jdk -y

Setup the JAVA_HOME environment variable, and then add Temurin 17 OpenJDK to the PATH environment variable:

$ echo "export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile && source /etc/profile
$ echo "export PATH=$PATH:$JAVA_HOME/bin" | sudo tee -a /etc/profile && source /etc/profile
$ echo $JAVA_HOME
$ echo $PATH

Confirm the installation of Temurin 17 OpenJDK:

$ java --version
openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)

3. Install Minecraft Java Edition Server 1.18.2

Create a directory for Minecraft Java Edition server:

$ sudo mkdir /opt/minecraft
$ sudo chown mcninja:mcninja /opt/minecraft

Download Minecraft Java Edition server 1.18.2 using the download link found from the official Minecraft Java Edition Server Download Page.

$ cd /opt/minecraft
$ wget -O minecraft_server.1.18.2.jar

Create a text file to confirm that you agree to the Minecraft end-user license agreement:

$ echo "eula=true" > /opt/minecraft/eula.txt

Test drive Minecraft Java Edition server 1.18.2:

$ cd /opt/minecraft
$ java -Xms1024M -Xmx1024M -jar /opt/minecraft/minecraft_server.1.18.2.jar nogui
[06:59:58] [Server thread/INFO]: Done (62.240s)! For help, type "help"

Note: In the previous command, the -Xms1024M and -Xmx1024M flags define initial and maximum memory allocation values for the Minecraft Java Edition server. Both are 1024M in this case. The two values are suitable for a Debian 11 server instance with 2GB of memory. Consider increasing the values if your server instance has more memory.

When you see the server prompts Done!, which means it is up and running:

  1. Launch your Minecraft client.
  2. Add a server name and the server's IPv4 address, such as for example.
  3. Join the server to explore the newly created world.

After the test drive, press Ctrl+C in the SSH terminal to stop Minecraft Java Edition server 1.18.2.

To customize your Minecraft Java Edition server, you need to edit a newly generated file named within the Minecraft Java Edition server directory.

For example, if you want to allow non-premium players to log in to your Minecraft server:

$ nano /opt/minecraft/

Find the line:


Change it to:


Press Ctrl+O, Enter, and Ctrl+X to save your changes and quit. And then restart the Minecraft Java Edition server to load the new settings.

To learn more about configuring Minecraft server properties, visit the Minecraft Wiki page.

4. Install Supervisor

To keep the Minecraft Java Edition server running, it's recommended to use the Supervisor program to start and restart the Minecraft Java Edition server processes automatically.

Install the Supervisor program:

$ sudo apt install supervisor -y
$ supervisord -v

Start the Supervisor service:

sudo systemctl daemon-reload
sudo systemctl start supervisor.service
sudo systemctl enable supervisor.service

Create a Supervisor configuration file for the Minecraft Java Edition server:

$ sudo nano /etc/supervisor/conf.d/minecraft.conf

Populate the file with:

command=java -Xms1024M -Xmx1024M -jar /opt/minecraft/minecraft_server.1.18.2.jar nogui

Press Ctrl+O, Enter, and Ctrl+X to save the configuration file and quit.

Load the Minecraft Java Edition server configuration file:

$ sudo supervisorctl reread
$ sudo supervisorctl update

Determine if the Minecraft Java Edition server is up and running:

$ tail -f /var/log/supervisor/out_minecraft.log
[08:15:49] [Server thread/INFO]: Done (123.024s)! For help, type "help"

Press Ctrl+C to quit the tail program at any time.

More Information