Skip to main content
← All guides

Creating a Minecraft server (Java Edition, Paper and vanilla)

Here's how to install a Minecraft Java Edition server on an Ubuntu server and play on it with your friends.

Before you start

1. Install Java

The latest Minecraft (1.21 and above) needs Java 21.

sudo apt update
sudo apt install -y openjdk-21-jre-headless screen
java -version

2. Download the server file

Create a folder for the server and download the server executable (.jar).

  • Vanilla (official): Copy the server.jar link from the "Minecraft: Java Edition server download" page on minecraft.net.
  • Paper (supports plugins, lighter): Copy the link for the version you want from the download page on papermc.io.
mkdir ~/minecraft && cd ~/minecraft
wget -O server.jar "copied download link"

3. First run and agreeing to the EULA

java -Xms1G -Xmx3G -jar server.jar nogui

On the first run, it exits right away and creates an eula.txt file. Change it to the setting that agrees to Minecraft's terms of use.

sed -i 's/eula=false/eula=true/' eula.txt

-Xmx3G is the maximum memory given to the server. Set it leaving 1–2GB of the server's total memory for the operating system. (e.g., 4GB server → -Xmx3G, 8GB server → -Xmx6G)

4. Keep it running after closing the window (screen)

Closing the SSH window shuts the server down too, so run it inside screen.

screen -S mc
java -Xms1G -Xmx3G -jar server.jar nogui
  • Leave while keeping the server running: press Ctrl + A, then D
  • Go back to the server console: screen -r mc
  • Stop the server: type stop in the server console

5. Open the firewall

If you've turned on the firewall (ufw), open the Minecraft port. (Opening firewall ports)

sudo ufw allow 25565/tcp

6. Connect

In Minecraft → Multiplayer → Add Server, enter the server IP as the Server Address. If you're using the default port (25565), you can leave the port out.

Common problems

  • I can't connect — Check that Done (...)! For help, type "help" has appeared in the server console, and that 25565 is open in the firewall.
  • It's really laggy — Increase the -Xmx memory, switch to a Paper server, or consider a plan with higher specs.
  • The server suddenly shut down — It may have been forcibly shut down because it ran out of memory. Check that you set -Xmx lower than the server's memory.
  • World backups — With the server stopped, download the world folder to your PC. Uploading and downloading files

If your problem isn't solved, open a ticket on our Discord.