Rogue Security Wiki

Practical procedure and troubleshooting notes for Create a Minecraft Server on Proxmox.


This Guide is assuming that you understand some of the fundamental knowledge of proxmox and Ubuntu Linux


VM Settings

Setting Value
VM ID An Unused Value
Name What ever you would like to name it
OS Ubuntu Server ISO
Hard Disk 40 GB
CPU 2 vCPU
Memory 4096 MiB or 8192 MiB
Network default bridged network

Install Ubuntu Server

Prepare your environment

sudo apt update && sudo apt upgrade -y
sudo apt install -y openjdk-21-jdk
sudo adduser minecraft # Follow the process
sudo mkdir -p /opt/minecraft/server
sudo chown -R minecraft:minecraft /opt/minecraft/server
sudo -u minecraft -i
cd /opt/minecraft/server

# Go to https://fabricmc.net/use/server/ Use the next two commands from there website for the server version you would like to install
curl -OJ https://meta.fabricmc.net/v2/versions/loader/1.21.11/0.18.4/1.1.1/server/jar
java -Xmx2G -jar fabric-server-mc.1.21.11-loader.0.18.4-launcher.1.1.1.jar nogui

ctrl+C
cd ./mods

# Use wget to obtain the mods that you would like to install
wget https://www.curseforge.com/minecraft/mc-mods/fabric-api/download/7514389

cd ..
echo "eula=true" > eula.txt

# Create a Minecraft Service
exit
sudo nano /etc/systemd/system/minecraft.service

# Add this to /etc/systemd/system/minecraft.service Ensure you use the second command that you pulleed from fabrics website for the line ExecStart
[Unit]
Description=Minecraft Fabric Server
After=network.target

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft/server
ExecStart=/usr/bin/java -Xmx2G -jar fabric-server-mc.1.21.11-loader.0.18.4-launcher.1.1.1.jar nogui
Restart=on-failure

[Install]
WantedBy=multi-user.target

ctrl+X
y enter

# enable your service
sudo systemctl daemon-reload
sudo systemctl enable minecraft

# add your player as OP 
sudo -u minecraft -i
cd /opt/minecraft/server
nano ops.json

# Add to ops.json
[
  {
    "uuid": "YOUR_UUID found on https://mcuuid.net/",
    "name": "YourMinecraftUsername",
    "level": 4,
    "bypassesPlayerLimit": false
  }
]

ctrl+X
y enter

exit

# Start your Server
sudo systemctl start minecraft
sudo systemctl status minecraft

Optionally Mount a Nas and Back up your Server

Mount Nas for Backups

mkdir -p /mnt/nas 
mount -t cifs "//yournas/directory" /mnt/nas -o username=YOURUSERNAME
ls /mnt/nas
sudo cp /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab
# add the line
//192.168.1.19/DylansNas /mnt/nas cifs username=dylan 
# You will need to run mount -a when loggin in I was unsuccsful with adding password

Create Cron Job

sudo nano /opt/minecraft/backup.sh

# Add this to /opt/minecraft/backup.sh
#!/bin/bash

# Variables
SERVER_DIR="/opt/minecraft/server"
BACKUP_DIR="/mnt/nas/Minecraft/Backups"
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
WORLD_DIR="$SERVER_DIR/world"

# Make sure backup folder exists
mkdir -p "$BACKUP_DIR"

# Stop the server gracefully
systemctl stop minecraft

# Backup world folder
tar -czf "$BACKUP_DIR/world_$TIMESTAMP.tar.gz" -C "$SERVER_DIR" world

# Optional: keep only last 7 backups
ls -1t "$BACKUP_DIR"/world_*.tar.gz | tail -n +8 | xargs -r rm

# Start the server
systemctl start minecraft

ctrl+X
y enter

sudo chmod +x /opt/minecraft/backup.sh
sudo apt install cron
sudo systemctl enable --now cron
sudo crontab -e
0 3 * * * /opt/minecraft/backup.sh >> /var/log/minecraft_backup.log 2>&1