Blog / Tutorials

How to Setup a Minecraft Vanilla 1.19.2 Server (Java 17) on Ubuntu/Debian

3 min read
VoxiHost Team
How to Setup a Minecraft Vanilla 1.19.2 Server (Java 17) on Ubuntu/Debian

The 1.18 to 1.20.4 era of Minecraft relies on Java 17. This guide covers the entire Java 17 lifecycle. For information on other versions, see our Minecraft Java Server Compatibility Guide.

Do not run as root: Always host your Minecraft instance through a restricted user account to protect your VPS files from potential game-layer exploits.

Prerequisites

  • A VPS running Ubuntu or Debian (Available on Premium VPS).
  • Sudo access for initial Java installation.
  • High-speed SSD/NVMe storage (all VoxiHost nodes use NVMe).

Supported Versions

This Java 17 guide is fully compatible with:

  • 1.20 Era: 1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20
  • 1.19 Era: 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19
  • 1.18 Era: 1.18.2, 1.18.1, 1.18

Need a different version? Find the direct URL in our Minecraft Vanilla Server Download Links Archive.

Step 1: Install Java 17

Keep your system secure by performing a full System Update first. Then, install the required LTS Java 17 package:

Terminal output showing the installation of OpenJDK 17 on an Ubuntu/Debian system

sudo apt update
sudo apt install openjdk-17-jre-headless -y

Step 2: Create a Dedicated User

For security, never run your server as root. If you are new to Linux permissions, check our guide on How to Create and Manage Users on Ubuntu/Debian.

Creating a dedicated 'minecraft' user to safely host the 1.19 server

sudo adduser --disabled-password --gecos "" minecraft
sudo su - minecraft
mkdir server && cd server

Step 3: Download Minecraft 1.19.2

Looking for a different version? You can find direct Mojang download links for all releases in our Minecraft Server Download Archive.

Downloading the official Minecraft 1.19.2 server.jar file from Mojang servers using wget

wget https://piston-data.mojang.com/v1/objects/f69c284232d7c7580bd89a5a4931c3581eae1378/server.jar

Step 4: Accept the EULA

First launch of the 1.19.2 JAR to generate configuration files and accept the EULA

Run the server once to generate the required configuration files:

java -jar server.jar nogui
sed -i 's/eula=false/eula=true/' eula.txt

Step 5: Create Launch Script

Pro Tip: Using the Nano Editor
Nano is a beginner-friendly text editor for the terminal. If the nano command is not found, install it using sudo apt install nano -y.

  • To Save: Press CTRL + O, then hit ENTER.
  • To Exit: Press CTRL + X.

Paste the following (Aikar's Flags optimized for G1GC):

Using the nano editor to create and configure the start.sh launch script

nano start.sh

In the editor, paste:

#!/bin/bash
java -Xmx6G -Xms6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikar.for.v1.20=false -jar server.jar nogui

Make it executable:

Setting executable permissions on the start.sh script

chmod +x start.sh

Step 6: First Launch & Administrator Setup

Before setting up the automatic background service, you should run the server manually at least once to grant yourself administrator (OP) rights.

1. Start the server manually

Starting the Minecraft 1.19.2 server manually to access the live console
Run the launch script you just created:

./start.sh

2. Grant Administrator (OP) rights

Granting administrative (OP) privileges via the server console
Once the server has finished loading (you see the "Done!" message), type your command directly into the console:

op your_minecraft_username

3. Stop the server

Safely shutting down the Minecraft 1.19.2 server using the stop command
To save the world data and prepare for background hosting, type:

stop

This will return you to the normal Linux command line.

Step 7: Configure Systemd Service

For a professional setup, we use systemd. This ensures your server starts automatically if the VPS reboots and handles crashes gracefully.

Exit the minecraft user back to your root/sudo account:

exit

Create the service file:

Creating the minecraft.service systemd file for professional background hosting

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

Paste the following configuration:

[Unit]
Description=VoxiHost Minecraft 1.19 Server
After=network.target

[Service]
User=minecraft
WorkingDirectory=/home/minecraft/server
ExecStart=/home/minecraft/server/start.sh
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable and start your server:

Enabling and starting the minecraft systemd service in the terminal

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

Managing Your Server

  • Check Status: sudo systemctl status minecraft
  • View Logs: sudo journalctl -u minecraft -f
  • Stop Server: sudo systemctl stop minecraft

Next Steps: Security & Management

Now that your server is running, don't forget to:

  1. DDoS Protection: All VoxiHost servers include automatic VoxiShield protection. Your server is already being monitored to prevent downtime during attacks.
  2. Open the Firewall: Allow traffic on port 25565 by running: sudo ufw allow 25565/tcp. For more details, see our UFW Setup Guide.
  3. Transfer Files: Want to upload an existing world? Use SFTP as explained in our FileZilla Tutorial.
  4. Hardening & Monitoring: Protect your VPS further by securing SSH and setting up Fail2ban. You can also monitor your system resources using htop.

Your server is ready! For low-latency hosting, explore our VoxiHost Budget VPS options.

Languages