> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Host a Minecraft Server on a Linux VPS

> Host a Minecraft server on a Linux VPS: install Java 25, download server.jar, accept the EULA, start it with java -jar server.jar nogui and open port 25565.

To host a Minecraft Java server on a Linux VPS, install Java 25 (`sudo apt install openjdk-25-jre-headless` on Ubuntu 24.04), download `server.jar` from minecraft.net, run it once, set `eula=true` in `eula.txt`, then start it with `java -Xms2G -Xmx2G -jar server.jar nogui` inside `tmux`. Allow TCP port 25565 in your firewall and join with your server's IP.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Intermediate | 20 minutes | Ubuntu 24.04, AlmaLinux / Rocky 9 / 10, Debian 13 | Root or sudo, 2 GB RAM or more |

FREAKHOSTING also offers managed Minecraft servers on its Game Panel, if you'd rather not run the server yourself: see the [Minecraft server hosting guide](https://help.freakhosting.com/games/minecraft/minecraft-server-hosting-guide.md).

## Before you start

* Log in over SSH as root or a [sudo user](https://help.freakhosting.com/portals/other/how-to-create-a-sudo-user-on-linux.md). Root users can leave out `sudo`.
* Running the Minecraft server software means you accept the [Minecraft End User License Agreement](https://www.minecraft.net/en-us/eula). You accept it yourself in step 5.
* Plan memory: leave about 1 GB for the operating system. On a 4 GB VPS, give Minecraft 2–3 GB.

## Which Java version does Minecraft need?

| Minecraft Java Edition | Java |
| - | - |
| 26.1 and newer | Java 25 |
| 1.20.5 to 1.21.11 | Java 21 |

## How to set up the Minecraft server

**1. Install Java**

> [tab] Ubuntu 24.04
>
> ```bash theme={null}
> sudo apt update
> sudo apt install openjdk-25-jre-headless tmux
> ```

> [tab] AlmaLinux / Rocky
>
> ```bash theme={null}
> sudo dnf install java-25-openjdk-headless tmux
> ```

> [tab] Debian 13
>
> Install Eclipse Temurin 25 from the [Adoptium repository](https://adoptium.net/installation/linux/):
>
> ```bash theme={null}
> sudo apt install -y wget apt-transport-https gpg tmux
> wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null
> echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
> sudo apt update
> sudo apt install temurin-25-jdk
> ```

Check it with `java -version`. The first line shows a version starting with `25`, for example `openjdk version "25.0.4.1"`. If an older Java is still the default, pick Java 25 with `sudo update-alternatives --config java` (Ubuntu/Debian) or `sudo alternatives --config java` (AlmaLinux/Rocky).

**2. Create a user for the server**

Don't run Minecraft as root. Create a user with its own home folder:

```bash theme={null}
sudo useradd -m -d /opt/minecraft -s /bin/bash minecraft
sudo -iu minecraft
```

The rest of the steps run as `minecraft`.

**3. Download server.jar**

On [minecraft.net/download/server](https://www.minecraft.net/en-us/download/server), right-click the `server.jar` link and copy the address. Then:

```bash theme={null}
mkdir -p ~/server && cd ~/server
wget -O server.jar "PASTE-THE-LINK-FROM-MINECRAFT.NET"
```

**4. Run it once**

```bash theme={null}
java -Xms1G -Xmx1G -jar server.jar nogui
```

The server stops straight away and creates `eula.txt` and `server.properties`.

**5. Accept the EULA**

After reading the EULA, set `eula=true`:

```bash theme={null}
sed -i 's/eula=false/eula=true/' eula.txt
```

**6. Start the server in tmux**

`tmux` keeps the server running after you close SSH:

```bash theme={null}
tmux new -s minecraft
java -Xms2G -Xmx2G -jar server.jar nogui
```

Wait for `Done (…)! For help, type "help"`. Press **Ctrl+B**, then **D** to detach. Reattach later with `tmux attach -t minecraft`. See [tmux and screen](https://help.freakhosting.com/portals/other/how-to-keep-ssh-sessions-running-with-tmux-and-screen.md).

## How to open port 25565

Minecraft Java uses TCP port 25565 by default (`server-port` in `server.properties`). Exit the `minecraft` user (`exit`) and run:

> [tab] Ubuntu / Debian (ufw)
>
> ```bash theme={null}
> sudo ufw allow 25565/tcp
> ```

> [tab] AlmaLinux / Rocky (firewalld)
>
> ```bash theme={null}
> sudo firewall-cmd --permanent --add-port=25565/tcp
> sudo firewall-cmd --reload
> ```

> [!WARNING]
>
> If `ufw` is not active yet, allow SSH first (`sudo ufw allow OpenSSH`) before you run `sudo ufw enable`, or you lock yourself out. See [set up a firewall with UFW](https://help.freakhosting.com/portals/other/how-to-set-up-a-firewall-with-ufw.md). If it happens, use the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md).

## How to check it worked

```bash theme={null}
ss -tlnp | grep 25565
```

You see a line with `*:25565` and `java`. In Minecraft, open **Multiplayer > Add Server** and enter `203.0.113.10` (your server's IP). Add `:port` only if you changed `server-port`.

## How to manage the server

| Task | How |
| - | - |
| Run a server command | Attach with `tmux attach -t minecraft` and type it, for example `op alex` |
| Stop and save | Type `stop` in the console |
| Turn on the whitelist | `whitelist on`, then `whitelist add alex` |
| Change settings | Stop the server, edit `~/server/server.properties`, start it again |
| Update Minecraft | Stop the server, back up the folder, replace `server.jar` with the new version, start it |
| Back up the world | Stop the server, then `tar -czf ~/world-$(date +%F).tar.gz -C ~/server world` |

To start Minecraft automatically at boot, run it as a [systemd service](https://help.freakhosting.com/portals/other/how-to-create-a-systemd-service.md).

## Frequently asked questions

### How much RAM does a Minecraft server need?

It depends on players, view distance and mods. A few players on vanilla run in 2 GB. Watch real use with [htop](https://help.freakhosting.com/portals/other/how-to-monitor-server-resources-with-htop.md) and raise `-Xmx` if the server is short of memory, keeping about 1 GB free for the system.

### Why do I get UnsupportedClassVersionError?

Your Java is too old for that Minecraft version. Install the Java version from the table above and check with `java -version`.

### Can friends join without my IP?

Point a domain such as `mc.example.com` at your server with an `A` record. See [point a domain to your server](https://help.freakhosting.com/portals/other/how-to-point-a-domain-to-your-server.md).

### Should I use Paper instead of vanilla?

Paper is a popular server with better performance and plugin support. Install it the same way, with the Paper jar instead of `server.jar`.

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Tune Linux for game servers](https://help.freakhosting.com/portals/other/how-to-tune-linux-for-game-servers.md)
>
> Lower lag on your VPS.

> [card] [Host game servers with LinuxGSM](https://help.freakhosting.com/portals/other/how-to-host-game-servers-with-linuxgsm.md)
>
> Scripts for 100+ game servers.

> [card] [Install Pterodactyl Panel](https://help.freakhosting.com/portals/other/how-to-install-pterodactyl-panel-on-a-vps.md)
>
> Manage game servers in a web panel.

> [card] [Keep sessions running with tmux](https://help.freakhosting.com/portals/other/how-to-keep-ssh-sessions-running-with-tmux-and-screen.md)
>
> Detach and reattach the console.

***

> [!NOTE]
>
> **Checked against [Minecraft Java Edition 26.1 release notes](https://feedback.minecraft.net/hc/en-us/articles/44551668333837-Minecraft-Java-Edition-26-1)** (Java 25 requirement) and the [Adoptium install docs](https://adoptium.net/installation/linux/) on 4 November 2026; Java 25 install tested on Ubuntu 24.04 LTS; the RHEL 9 / 10 package name checked in the vendor repositories. Commands can differ on other distributions or releases.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.