How to Install a Minecraft Server on a Linux VPS: Vanilla, Paper and NeoForge

How to Install a Minecraft Server on a Linux VPS: Vanilla, Paper and NeoForge

Installing a Minecraft server on a VPS gives you full control over files, Java, ports, plugins, mods, backups, and automatic restarts. The tradeoff is that you need to be precise: the wrong Java version, a busy port, or a broken systemd service can stop the server from launching.

This guide starts from an Ubuntu or Debian VPS with SSH access and sudo privileges. It shows three practical setups: a vanilla Minecraft server, a Paper server with a plugin, and a NeoForge server with a mod. The examples use separate directories and ports so you can test without mixing files:

  • Vanilla: /opt/minecraft/vanilla, service minecraft, port 25565
  • Paper: /opt/minecraft/paper, service minecraft-paper, port 25566
  • NeoForge: /opt/minecraft/neoforge, service minecraft-neoforge, port 25567

In production, you usually choose one server type and keep port 25565. Do not run all three at the same time on a small VPS: with -Xmx8G per server, three services can use a lot of memory.

On June 28, 2026, Mojang’s official manifest returns Minecraft 26.2 as the latest stable release, and that version requires Java 25. To keep the copyable blocks simple, the examples below use 26.2 and explicit versions for LuckPerms, NeoForge, and spark. Replace those values if you target another version.

1. Install Java and the common tools

Connect to your VPS over SSH, then install Java, curl, and jq. curl downloads files, and jq reads JSON responses from the Mojang and Paper APIs.

sudo apt update
sudo apt install -y openjdk-25-jre-headless curl jq ca-certificates
java -version

If your distribution does not provide OpenJDK 25 yet, update it or install a maintained Java build for your system. An outdated Java version often fails before the server can fully create its files.

Create a dedicated system user and the three example directories.

id minecraft >/dev/null 2>&1 || sudo useradd --system --home-dir /opt/minecraft --create-home --shell /usr/sbin/nologin minecraft
sudo install -d -o minecraft -g minecraft /opt/minecraft/vanilla /opt/minecraft/paper /opt/minecraft/neoforge

This keeps Minecraft away from root and limits the impact of a problematic plugin, mod, or script.

2. Install a vanilla Minecraft server

Vanilla is Mojang’s official server. It is the best starting point to check Java, ports, and the Linux service before adding plugins or mods.

cd /opt/minecraft/vanilla

MC_VERSION="26.2"
MANIFEST="https://piston-meta.mojang.com/mc/game/version_manifest_v2.json"
VERSION_URL=$(curl -fsSL "$MANIFEST" | jq -r --arg version "$MC_VERSION" '.versions[] | select(.id == $version) | .url')
sudo curl -fLo server.jar "$(curl -fsSL "$VERSION_URL" | jq -r '.downloads.server.url')"
sudo chown minecraft:minecraft server.jar

Accept the EULA and create a minimal server.properties. Vanilla keeps the standard 25565 port.

cd /opt/minecraft/vanilla

echo "eula=true" | sudo tee eula.txt >/dev/null
sudo tee server.properties >/dev/null <<'EOF'
server-port=25565
motd=Vanilla Minecraft VPS server
online-mode=true
view-distance=8
simulation-distance=6
EOF
sudo chown minecraft:minecraft eula.txt server.properties

Run the first manual start. Wait for the Done ( line in the console, then stop with Ctrl+C.

cd /opt/minecraft/vanilla
sudo -u minecraft java -Xms2G -Xmx8G -jar server.jar nogui

Now create the systemd service.

sudo tee /etc/systemd/system/minecraft.service >/dev/null <<'EOF'
[Unit]
Description=Minecraft Vanilla server
After=network.target

[Service]
User=minecraft
Group=minecraft
WorkingDirectory=/opt/minecraft/vanilla
ExecStart=/usr/bin/java -Xms2G -Xmx8G -jar server.jar nogui
Restart=on-failure
RestartSec=10
SuccessExitStatus=0 130 143
KillSignal=SIGINT
TimeoutStopSec=60

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable minecraft
sudo systemctl start minecraft
sudo systemctl status minecraft --no-pager

Follow the vanilla logs with:

sudo journalctl -u minecraft -f

3. Install Paper and add a plugin

Paper is a common base for plugin servers. In this example, we download the latest Paper build available for MC_VERSION, then install the LuckPerms plugin into the plugins directory.

Paper requires an explicit User-Agent on its API. You can replace [email protected] with your administration email.

cd /opt/minecraft/paper

MC_VERSION="26.2"
USER_AGENT="MinecraftVpsTutorial/1.0 (contact: [email protected])"
PAPER_BUILDS="https://fill.papermc.io/v3/projects/paper/versions/$MC_VERSION/builds"
PAPER_URL=$(curl -fsSL -H "User-Agent: $USER_AGENT" "$PAPER_BUILDS" | jq -r '.[0].downloads["server:default"].url')
sudo curl -fL -H "User-Agent: $USER_AGENT" -o server.jar "$PAPER_URL"
sudo chown minecraft:minecraft server.jar

Create the EULA and configuration. This example uses 25566 to avoid conflicting with vanilla. If you only use Paper, you can change it back to server-port=25565.

cd /opt/minecraft/paper

echo "eula=true" | sudo tee eula.txt >/dev/null
sudo tee server.properties >/dev/null <<'EOF'
server-port=25566
motd=Paper Minecraft VPS server
online-mode=true
view-distance=8
simulation-distance=6
EOF
sudo chown minecraft:minecraft eula.txt server.properties

Install a Paper plugin. To keep the command readable, this example uses a direct LuckPerms URL hosted by Modrinth.

cd /opt/minecraft/paper

sudo install -d -o minecraft -g minecraft plugins
LUCKPERMS_URL="https://cdn.modrinth.com/data/Vebnzrzj/versions/MBSY8toc/LuckPerms-Bukkit-5.5.53.jar"
sudo curl -fL -o plugins/LuckPerms.jar "$LUCKPERMS_URL"
sudo chown -R minecraft:minecraft plugins

Start Paper once. In the logs, you should see Paper starting and LuckPerms loading.

cd /opt/minecraft/paper
sudo -u minecraft java -Xms2G -Xmx8G -jar server.jar nogui

After Ctrl+C, create the minecraft-paper service.

sudo tee /etc/systemd/system/minecraft-paper.service >/dev/null <<'EOF'
[Unit]
Description=Minecraft Paper server
After=network.target

[Service]
User=minecraft
Group=minecraft
WorkingDirectory=/opt/minecraft/paper
ExecStart=/usr/bin/java -Xms2G -Xmx8G -jar server.jar nogui
Restart=on-failure
RestartSec=10
SuccessExitStatus=0 130 143
KillSignal=SIGINT
TimeoutStopSec=60

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable minecraft-paper
sudo systemctl start minecraft-paper
sudo systemctl status minecraft-paper --no-pager

Follow Paper live with:

sudo journalctl -u minecraft-paper -f

4. Install NeoForge and add a mod

NeoForge runs modded servers. Its installation is different from vanilla and Paper: you download an installer, it generates run.sh, then the server starts through that script. This example uses NeoForge 26.2.0.7-beta, which you can replace if a newer build matches your server.

cd /opt/minecraft/neoforge

NEOFORGE_VERSION="26.2.0.7-beta"
sudo curl -fLo neoforge-installer.jar "https://maven.neoforged.net/releases/net/neoforged/neoforge/$NEOFORGE_VERSION/neoforge-$NEOFORGE_VERSION-installer.jar"
sudo chown minecraft:minecraft neoforge-installer.jar
sudo -u minecraft java -jar neoforge-installer.jar --installServer
sudo chmod +x run.sh

NeoForge reads Java options from user_jvm_args.txt. Put the memory there, not directly in the systemd service.

cd /opt/minecraft/neoforge

sudo tee user_jvm_args.txt >/dev/null <<'EOF'
-Xms2G
-Xmx8G
EOF
sudo chown minecraft:minecraft user_jvm_args.txt

Create the EULA and server.properties. The example uses 25567 to avoid conflicts with vanilla or Paper.

cd /opt/minecraft/neoforge

echo "eula=true" | sudo tee eula.txt >/dev/null
sudo tee server.properties >/dev/null <<'EOF'
server-port=25567
motd=NeoForge Minecraft VPS server
online-mode=true
view-distance=8
simulation-distance=6
EOF
sudo chown minecraft:minecraft eula.txt server.properties

Now install a mod. The example downloads spark, a profiling mod that helps understand server performance, with an explicit version URL to avoid a long API block. On a real modded server, players usually need the same loader and the required client-side mods.

cd /opt/minecraft/neoforge

sudo install -d -o minecraft -g minecraft mods
SPARK_URL="https://cdn.modrinth.com/data/l6YH9Als/versions/DdMsOH3O/spark-1.10.173-neoforge.jar"
sudo curl -fL -o mods/spark.jar "$SPARK_URL"
sudo chown -R minecraft:minecraft mods

Start NeoForge once with run.sh. Wait for startup to finish, then stop with Ctrl+C.

cd /opt/minecraft/neoforge
sudo -u minecraft bash run.sh nogui

Finally, create the minecraft-neoforge service.

sudo tee /etc/systemd/system/minecraft-neoforge.service >/dev/null <<'EOF'
[Unit]
Description=Minecraft NeoForge server
After=network.target

[Service]
User=minecraft
Group=minecraft
WorkingDirectory=/opt/minecraft/neoforge
ExecStart=/usr/bin/bash /opt/minecraft/neoforge/run.sh nogui
Restart=on-failure
RestartSec=10
SuccessExitStatus=0 130 143
KillSignal=SIGINT
TimeoutStopSec=60

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable minecraft-neoforge
sudo systemctl start minecraft-neoforge
sudo systemctl status minecraft-neoforge --no-pager

Read the NeoForge logs with:

sudo journalctl -u minecraft-neoforge -f

5. Create an all-in-one start, stop, restart, logs, save, and restore command

systemctl works well, but one command is easier for daily use. The script below creates mcserver, which can control the three example services, create backups, and restore archives.

sudo tee /usr/local/bin/mcserver >/dev/null <<'EOF'
#!/usr/bin/env bash
set -euo pipefail

SERVER="${1:-}"
ACTION="${2:-}"

usage() {
  echo "Usage: mcserver {vanilla|paper|neoforge} {start|stop|restart|status|logs|save|restore}"
  echo "Restore: mcserver {vanilla|paper|neoforge} restore /path/to/backup.tar.gz"
}

case "$SERVER" in
  vanilla) SERVICE="minecraft"; SERVER_DIR="vanilla" ;;
  paper) SERVICE="minecraft-paper"; SERVER_DIR="paper" ;;
  neoforge) SERVICE="minecraft-neoforge"; SERVER_DIR="neoforge" ;;
  *)
    usage
    exit 1
    ;;
esac

case "$ACTION" in
  start|stop|restart|status)
    sudo systemctl "$ACTION" "$SERVICE"
    ;;
  logs)
    sudo journalctl -u "$SERVICE" -f
    ;;
  save)
    BACKUP_FILE="$HOME/minecraft-$SERVER-backup-$(date +%F-%H%M%S).tar.gz"
    sudo systemctl stop "$SERVICE"
    sudo tar -czf "$BACKUP_FILE" -C /opt/minecraft "$SERVER_DIR"
    sudo systemctl start "$SERVICE"
    echo "Backup created: $BACKUP_FILE"
    ;;
  restore)
    BACKUP_FILE="${3:-}"
    if [ -z "$BACKUP_FILE" ] || [ ! -f "$BACKUP_FILE" ]; then
      usage
      exit 1
    fi
    ROLLBACK_DIR="/opt/minecraft/${SERVER_DIR}.before-restore-$(date +%F-%H%M%S)"
    sudo systemctl stop "$SERVICE"
    if [ -d "/opt/minecraft/$SERVER_DIR" ]; then
      sudo mv "/opt/minecraft/$SERVER_DIR" "$ROLLBACK_DIR"
    fi
    sudo tar -xzf "$BACKUP_FILE" -C /opt/minecraft
    sudo chown -R minecraft:minecraft "/opt/minecraft/$SERVER_DIR"
    sudo systemctl start "$SERVICE"
    echo "Restored $SERVER from $BACKUP_FILE"
    echo "Previous folder kept at: $ROLLBACK_DIR"
    ;;
  *)
    usage
    exit 1
    ;;
esac
EOF

sudo chmod +x /usr/local/bin/mcserver

You can now manage servers with short commands.

mcserver vanilla start
mcserver vanilla stop
mcserver vanilla restart
mcserver vanilla status
mcserver vanilla logs
mcserver vanilla save
mcserver vanilla restore "$HOME/minecraft-vanilla-backup-2026-07-01-142600.tar.gz"

mcserver paper restart
mcserver paper save
mcserver neoforge logs
mcserver neoforge restore "$HOME/minecraft-neoforge-backup-2026-07-01-142600.tar.gz"

If you only use one server in production, keep only its line in the script, or simply continue with a command such as mcserver vanilla restart. For a restore, replace the archive path with the one printed by the save command.

6. Open the firewall ports

If you test the three examples, open the three ports. If you keep only one server, open only that server’s port. Start by adding the rules, then check the UFW state.

sudo ufw status
sudo ufw allow OpenSSH
sudo ufw allow 25565/tcp comment "Minecraft Vanilla"
sudo ufw allow 25566/tcp comment "Minecraft Paper"
sudo ufw allow 25567/tcp comment "Minecraft NeoForge"
sudo ufw status

If UFW is inactive and you want to use it as the local firewall, enable it only after allowing administrative SSH access.

sudo ufw enable

With iptables, a minimal equivalent rule looks like this:

sudo iptables -A INPUT -p tcp -m multiport --dports 25565,25566,25567 -j ACCEPT

Also check your VPS provider’s external firewall if a network firewall is available in its panel.

7. Make a clean backup

The mcserver script also handles backups. The save action stops the service, archives the matching directory, then starts the server again.

mcserver paper save
mcserver neoforge save

The command prints the path of the created archive, for example $HOME/minecraft-paper-backup-2026-07-01-142600.tar.gz. To restore, pass that file to the restore action.

mcserver paper restore "$HOME/minecraft-paper-backup-2026-07-01-142600.tar.gz"
mcserver neoforge restore "$HOME/minecraft-neoforge-backup-2026-07-01-142600.tar.gz"

During a restore, the current folder is kept under /opt/minecraft/<server>.before-restore-... before the archive is extracted. Keep several archives and test at least one restore. A backup that has never been restored is only an assumption.

8. Which server type should you choose?

Vanilla is the simplest choice if you want official Minecraft behavior without plugins or mods. Paper is the better choice if you want plugins such as permissions, land protection, economy, or administration commands. NeoForge is the right choice for a modded server, with mods installed server-side and often client-side too.

If you want to keep full Linux control and apply this tutorial on your own machine, you can start from a BoxToPlay VPS plan, then install the Minecraft server type you prefer. If you would rather avoid Linux administration, systemd services, ports, and manual backups, you can also launch a Minecraft server automatically with BoxToPlay. The panel handles installation and common actions, while you keep control over gameplay, plugins, and configuration.