Skip to content

Instantly share code, notes, and snippets.

@archae0pteryx
Last active June 30, 2022 18:15
Show Gist options
  • Save archae0pteryx/0015aa320dec702b8703de673eed0008 to your computer and use it in GitHub Desktop.
Save archae0pteryx/0015aa320dec702b8703de673eed0008 to your computer and use it in GitHub Desktop.
Minecraft AWS Linux 2 Setup Script
#!/bin/bash
sudo useradd minecraft
sudo usermod -a -G minecraft ec2-user
sudo mkdir -p /opt/minecraft/server
sudo chmod -R 775 /opt/minecraft
sudo chown -R minecraft:minecraft /opt/minecraft
# Install java
sudo rpm --import https://yum.corretto.aws/corretto.key
sudo curl -Lo /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
sudo yum -y install java-17-amazon-corretto-devel
# Install Paper-Mc
sudo su minecraft
cd /opt/minecraft/server
curl -o paper-1.19-41.jar https://api.papermc.io/v2/projects/paper/versions/1.19/builds/41/downloads/paper-1.19-41.jar
java -Xms13G -Xmx13G -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 -Daikars.new.flags=true -jar paper-1.19-41.jar --nogui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment