linux:software:host_minecraft_server

This is an old revision of the document!


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
  • linux/software/host_minecraft_server.1717144481.txt.gz
  • Last modified: 2024/05/31 10:34
  • by tplecko