How to Create a Minecraft Server on an Linux VPS
Step-by-Step Instructions
<ol><li>Update the system: sudo apt update && sudo apt upgrade -y.</li><li>Install Java: sudo apt install openjdk-17-jdk -y.</li><li>Create a directory and download the server jar: mkdir ~/minecraft-server && cd ~/minecraft-server, then wget the server.jar.</li><li>Run java -Xmx1024M -Xms1024M -jar server.jar nogui to generate config files.</li><li>Edit eula.txt with nano and set eula=true.</li><li>Re-run the java command to start the server.</li><li>Open the firewall: sudo ufw allow 25565 && sudo ufw enable.</li><li>Find your public IP with curl ifconfig.me and join via Multiplayer.</li></ol>
Code / Configuration
<pre><code>sudo apt update && sudo apt upgrade -y sudo apt install openjdk-17-jdk -y mkdir ~/minecraft-server && cd ~/minecraft-server wget https://piston-data.mojang.com/v1/objects/SERVER_JAR/server.jar java -Xmx1024M -Xms1024M -jar server.jar nogui # then set eula=true in eula.txt and run the java command again sudo ufw allow 25565 && sudo ufw enable</code></pre>
Info
For a persistent server, create a systemd service so the server auto-restarts on boot and after crashes.
Related Tutorials
Was this guide helpful?
Join our Discord for more guides and direct help from our engineering team.
