Summary
Hosting Minecraft on a VPS (Virtual Private Server) offers several benefits. A VPS provides a stable and dedicated environment for the server, free from the limitations and risks associated with hosting on a personal computer. This setup ensures a dedicated IP address, guaranteed resources, and full control over the server, resulting in a more reliable and efficient Minecraft experience.
Note | Ubuntu 22.04 is used in the guide below. |
How to Install Minecraft on a VPS Server (Java)
1. Log in to the VPS server.
2. Run the following commands to install Java JRE.sudo apt-get update
sudo apt install [OpenJDK version]
The required OpenJDK version depends on the Minecraft version and may vary in availability across different Ubuntu versions.
Minecraft Version |
Java Version |
OpenJDK Version |
1.16.x and below | Java 8 | openjdk-8-jre-headless |
1.17.x | Java 16 | openjdk-16-jre-headless |
1.18.x - 1.20.4 | Java 17 | openjdk-17-jre-headless |
1.20.5 and above | Java 21 | openjdk-21-jre-headless |
3. Input y
when prompted.
4. Install screen.sudo apt install screen -y
5. Create a non-privileged user for the Minecraft server.sudo useradd -r -U -d /usr/local/games/minecraft_server/ -s /usr/sbin/nologin [Username]
Note | Do not use root or a user with privileges to prevent security vulnerabilities and unauthorized access. |
6. Make the Minecraft folder.sudo mkdir -p /usr/local/games/minecraft_server/java
7. Grant folder permissions to the user created in step 5.sudo chown -R [Username]: /usr/local/games/minecraft_server/
8. Switch to the user.sudo su - [Username] -s /bin/bash
9. Enter the Minecraft folder.cd /usr/local/games/minecraft_server/java
10. Download the server.jar. Links can be retrieved from MCVersions.net.wget [server.jar link]
11. Create a screen for the Minecraft server.screen -S [Screen name]
12. Boot the Minecraft server. java -Xmx1024M -Xms1024M -jar server.jar nogui
13. Once it stops, accept the EULA.sed -i 's/\bfalse\b/TRUE/' eula.txt
14. Run the Minecraft server. Modify the Xmx
and Xms
RAM parameters as desired.java -Xmx1024M -Xms1024M -jar server.jar nogui
Note | RAM allocation should not exceed VPS RAM capacity. |