How to install Java & run a Minecraft server on a Linux VPS
How to install Java & run a Minecraft server on a Linux VPS
- Connect to your Linux VPS via SSH, then choose one of the following Java versions to use when running Minecraft:
- To install Java 8 (Recommended for Minecraft 1.8 - 1.16.5), Launch terminal, Run the command
sudo apt install openjdk-8-jdk -y
. - To install Java 11, Launch terminal, Run the command
sudo apt install openjdk-11-jdk -y
. - To install Java 16 (Recommended for Minecraft 1.17 - 1.17.1), Launch terminal, Run the command
sudo apt install openjdk-16-jdk -y
. - To install Java 17 (Recommended for Minecraft 1.18 - Newer Versions), Launch terminal, Run the command
sudo apt install openjdk-17-jdk -y
.
- Once you install Java, type in “mkdir Minecraft”, this will make a minecraft folder/directory, then cd into the directory by typing “cd Minecraft”.
- Once you're in the directory, get whatever jar file you would like (i.e. Spigot, Bukkit, Paper, etc.), I will use the spigot for this tutorial.
- Go back to the terminal and we will type the command “wget -O server.jar file_link_here”, this allows us to download the jar and move it to the minecraft directory. You are also able to use SFTP to upload the JAR file.
- We need to make it an executable, so we will type
sudo chmod +x file_name_here
.
- To run the server we will type in the terminal
java -Xmx4096M -Xms4096M -jar file_name_here nogui
.
- We then need to accept the eula, to do this we will type “nano eula.txt”, then change false to true. This is also possible using SFTP.
- Then use the command again to run the server.
If you require any further assistance, please create a ticket here.
Created By: Greg K.
Updated on: 11/11/2022
Thank you!