Do you want to play Minecraft with your friends on your own server? Hosting your own Minecraft server on an Ubuntu VPS is a good way to do that. It gives you full control, and it doesn’t cost much.
In this guide, I’ll show you how I set up a Minecraft server on Ubuntu step by step. I’ll keep it simple, and I’ll explain why each step matters.
If you’re new to servers or Ubuntu, don’t worry. You don’t need to be an expert. Just follow along carefully.
What You Need First
Before we begin, let’s go over what you’ll need.
- A VPS with at least 2 GB of RAM. More is better. I use 4 GB.
- Ubuntu installed. I use Ubuntu 22.04.
- A basic user account with sudo access.
- A little time and patience.
If you don’t have a VPS yet, some popular options are Hetzner, DigitalOcean, Linode, and Vultr. I use Hetzner because it’s cheaper for more RAM.
Step 1: Update Your VPS
Before installing anything, make sure your system is up to date.
Open your terminal and type:
sudo apt update && sudo apt upgrade -y
This will update all packages. It can take a minute or two. This step helps avoid issues later.
Step 2: Install Java
Minecraft requires Java. Most servers use the Java Edition of Minecraft.
You can install OpenJDK 17 like this:
sudo apt install openjdk-17-jdk -y
To check if it installed:
java -version
You should see something like:
openjdk version "17..."
If you see that, you’re good to go.
Step 3: Create a Minecraft User
It’s safer to run Minecraft as its own user. Let’s add one:
sudo adduser --disabled-login minecraft
Follow the prompts. You don’t need to fill in all the details.
Then switch to that user:
sudo su - minecraft
Now you’re logged in as the minecraft
user.
Step 4: Download the Minecraft Server File
Go to Minecraft’s official server page and copy the download link for the .jar
file.
Use wget
to download it:
wget https://launcher.mojang.com/v1/objects/YOUR_SERVER_FILE.jar -O server.jar
Change YOUR_SERVER_FILE.jar
to match the current version. Save it as server.jar
.
Step 5: Start the Server Once
Now try running it:
java -Xmx2G -Xms1G -jar server.jar nogui
This starts the server with 2 GB of RAM. Adjust if you have more.
The first time you run it, it will stop and ask you to accept the EULA.
Open the file:
nano eula.txt
Change:
eula=false
to:
eula=true
Then save and exit. Now you can run the server again.
Step 6: Open the Firewall
If your VPS has a firewall, open port 25565 (Minecraft’s default port):
sudo ufw allow 25565
You may also want to allow SSH if it’s not already:
sudo ufw allow OpenSSH
sudo ufw enable
Always check your firewall settings to make sure nothing blocks your server.
Step 7: Keep the Server Running in the Background
If you close your terminal, the server will stop. To keep it running, use a tool like screen
.
Install screen:
sudo apt install screen -y
Start a screen session:
screen -S minecraft
Run your server again:
java -Xmx2G -Xms1G -jar server.jar nogui
To leave the screen session:
Press Ctrl + A
, then D
.
To return to it later:
screen -r minecraft
Step 8: Connect to Your Server
Now go into Minecraft on your computer.
- Click Multiplayer
- Click Add Server
- Enter your VPS IP address as the server address
Your server should show up. Click Join Server.
If it doesn’t show, double-check:
- You accepted the EULA
- The server is still running
- Port 25565 is open
Benefits of Hosting Your Own Server
Why would you want to host your own Minecraft server instead of using realms or third-party hosts?
Here are a few reasons I like it:
- Full control — You can change settings, install mods, and make backups.
- No monthly fee for per-player pricing. You pay for the VPS, not the number of players.
- Privacy — Your world is on your terms.
Commands I Use Often
Once your server is running, here are some useful commands:
stop
– cleanly shuts down the server/op yourname
– gives you admin rights in-game/whitelist on/off
– control who joins/save-all
– manually saves the world
You can run these in-game or from the server console.
What to Watch Out For
Here are a few things that gave me trouble when I was new:
- Too little RAM – Minecraft crashes or lags with less than 2 GB.
- Firewall issues – Server runs, but you can’t connect.
- Wrong Java version – Minecraft only works with certain Java versions.
- No swap – If RAM runs out and you don’t have swap, the server may freeze.
Make sure you test and monitor the server often, especially if others are playing.
Should You Use Spigot or Vanilla?
There are different types of Minecraft servers.
Vanilla is the default Minecraft server from Mojang. It has no mods.
Spigot and Paper are modified versions. They support plugins and run faster.
If you want to keep things simple, use vanilla.
If you want plugins like teleport or anti-grief tools, try Paper.
Final Thoughts
Hosting your own Minecraft server on Ubuntu isn’t too hard. You just need to follow each step carefully. I like doing it this way because I get more control, and it runs well if I tune it right.
If your friends play a lot, you might want to use Paper or add plugins later. But to start, vanilla works fine.
Have you tried running a server before? Did it work the first time?