linux:software:host_minecraft_server

Host your own Minecraft server

Installation procedure
# Update package list and install Java
sudo apt-get update
sudo apt install default-jre-headless
 
#check if Java is installed
Java -version
 
#create unprivileged user
sudo useradd -r -U -d /usr/local/games/minecraft_server/ -s /usr/sbin/nologin minecraft
sudo mkdir -p /usr/local/games/minecraft_server/Java
sudo chown -R minecraft: /usr/local/games/minecraft_server/
 
# Impersonate that user
sudo su - minecraft -s /bin/bash
cd /usr/local/games/minecraft_server/Java
 
# Download server and run it for the first time
wget https://piston-data.mojang.com/v1/objects/8dd1a28015f51b1803213892b50b7b4fc76e594d/server.jar
Java -Xmx1024M -Xms1024M -jar server.jar nogui
 
# Accept EULA and run server
sed -i 's/\bfalse\b/TRUE/' eula.txt
Java -Xmx1024M -Xms1024M -jar server.jar nogui

This has the problem of exiting when SSH is disconnected, so the best way is to start it in Screen

sudo apt install screen -y
screen -S mc_Java_server -dm Java -Xmx1024M -Xms1024M -jar server.jar nogui

System resources

Requirements Players CPU RAM Storage WAN Up WAN Down
Minimum 1-4 Intel Core 2 Duo or AMD Athlon 64 x2 1GB At least 150MB for world saves 3Mbit/s 2 Mbit/s
Recomended 5-10 Intel Core 2 Duo or AMD Athlon 64 x2 2GB At least 200MB for world saves 6Mbit/s 3 Mbit/s
Best 10+ Intel Core i5-4690 or AMD Ryzen 5 1600 4GB At least 200MB SSD 14Mbit/s 8 Mbit/s
  • linux/software/host_minecraft_server.txt
  • Last modified: 2024/05/31 10:45
  • by tplecko