- Update the system: Run sudo apt update && sudo apt upgrade -y to ensure the latest environment; 2. Install Java: Use sudo apt install openjdk-17-jdk -y to install OpenJDK 17 that is adapted to the new version of Minecraft; 3. Create a dedicated user: execute adduser minecraft and switch su - minecraft to improve security; 4. Download the server JAR: Use wget to obtain the official Minecraft server jar file and rename it to minecraft_server.jar; 5. First run generation configuration: execute java -Xmx2G -Xms1G -jar minecraft_server.jar nogui and modify eula=true in eula.txt; 6. Start the service again: The same command runs the server again and shuts it down normally to complete the initialization; 7. Background run settings: Optional screen or create systemd service (recommended) to achieve self-start; 8. Open port: Use sudo ufw to allow 25565/tcp and confirm that the VPS firewall to release the port; 9. Connection test: Add server IP: 25565 to the Minecraft client to verify the successful connection, so you have a Minecraft server running stably on Linux VPS.
Setting up a Minecraft server on a Linux VPS isn't as intimidating as it sounds—especially if you're comfortable with basic command-line tools. Here's how to do it step by step, assuming you're using Ubuntu or Debian (most common for VPS providers like DigitalOcean, Linode, or AWS).

? 1. Update Your System
Before installing anything, make sure your system is up to date:
sudo apt update && sudo apt upgrade -y
? 2. Install Java
Minecraft Java Edition servers require Java. Install OpenJDK 17 (recommended for newer Minecraft versions like 1.17):

sudo apt install openjdk-17-jdk -y
Check it's installed:
java -version
You should see something like openjdk version "17.xx"
.

? 3. Create a User for the Server (Optional but Recommended)
Don't run Minecraft as root. Create a dedicated user:
adduser minecraft
Then switch to that user:
su - minecraft
? 4. Download Minecraft Server JAR
Go to the official Minecraft server download page and copy the latest server JAR link.
In your terminal (as the minecraft
user):
wget <paste-the-jar-url-here> # Example: wget https://piston-data.mojang.com/v1/objects/84194a2f286ef7c1cfed88c85b5238f8075e168e/server.jar
Rename it for simplicity (optional):
mv server.jar minecraft_server.jar
? 5. Run the Server Once to Generate Config Files
java -Xmx2G -Xms1G -jar minecraft_server.jar nogui
-
-Xmx2G
= max RAM (adjust based on your VPS—1GB min, 2–4GB ideal) -
-Xms1G
= starting RAM -
nogui
= no GUI (required on headless servers)
This will fail the first time because eula.txt
doesn't exist yet.
Now edit the EULA:
nano eula.txt
Change eula=false
to eula=true
, save and exit ( Ctrl O
, Enter
, Ctrl X
).
? 6. Start the Server Again
java -Xmx2G -Xms1G -jar minecraft_server.jar nogui
Now it should start and generate world files, server.properties
, etc.
Once it fully starts, type stop
in the console to shut it down cleanly.
? 7. Make It Run in Background (Use Screen or Systemd)
Option A: Using screen
(Simple)
Install screen:
sudo apt install screen -y
Then:
screen -S minecraft java -Xmx2G -Xms1G -jar minecraft_server.jar nogui
Press Ctrl A
, then D
to detach. To reattach later:
screen -r minecraft
Option B: Use a systemd service (Better for auto-start)
As root, create a service file:
sudo nano /etc/systemd/system/minecraft.service
Paste this (adjust paths and RAM):
[Unit] Description=Minecraft Server After=network.target [Service] User=minecraft WorkingDirectory=/home/minecraft ExecStart=/usr/bin/java -Xmx2G -Xms1G -jar minecraft_server.jar nogui Restart=always [Install] WantedBy=multi-user.target
Save, then:
sudo systemctl enable minecraft.service sudo systemctl start minecraft.service
Check status:
sudo systemctl status minecraft.service
? 8. Open the Port
Minecraft uses port 25565 by default. Allow it:
sudo ufw allows 25565/tcp
(If UFW isn't set up yet, run sudo ufw enable
first.)
Also make sure your VPS provider allows that port in their firewall/network settings (eg, DigitalOcean Cloud Firewalls).
? 9. Connect to Your Server
From the Minecraft client:
- Multiplayer → Add Server
- Server Address:
your.vps.ip.address:25565
If you can connect, congrats! You've got a working server.
? Bonus Tips
- Backups : Regularly back up the
/home/minecraft
folder (especiallyworld/
). - Plugins : Install PaperMC instead of vanilla for better performance and plugin support.
- Performance : If your VPS has 1GB RAM or less, consider using Aikar's flags for better GC tuning.
That's it! You now have a functional, background-running Minecraft server on your Linux VPS.
No need for hosting services—just your own box and a little command line magic.
The above is the detailed content of Setting up a Minecraft Server on a Linux VPS. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

LXD is described as the next-generation container and virtual machine manager that offers an immersive for Linux systems running inside containers or as virtual machines. It provides images for an inordinate number of Linux distributions with support

Firefox browser is the default browser for most modern Linux distributions such as Ubuntu, Mint, and Fedora. Initially, its performance might be impressive, however, with the passage of time, you might notice that your browser is not as fast and resp

When encountering DNS problems, first check the /etc/resolv.conf file to see if the correct nameserver is configured; secondly, you can manually add public DNS such as 8.8.8.8 for testing; then use nslookup and dig commands to verify whether DNS resolution is normal. If these tools are not installed, you can first install the dnsutils or bind-utils package; then check the systemd-resolved service status and configuration file /etc/systemd/resolved.conf, and set DNS and FallbackDNS as needed and restart the service; finally check the network interface status and firewall rules, confirm that port 53 is not

If you find that the server is running slowly or the memory usage is too high, you should check the cause before operating. First, you need to check the system resource usage, use top, htop, free-h, iostat, ss-antp and other commands to check CPU, memory, disk I/O and network connections; secondly, analyze specific process problems, and track the behavior of high-occupancy processes through tools such as ps, jstack, strace; then check logs and monitoring data, view OOM records, exception requests, slow queries and other clues; finally, targeted processing is carried out based on common reasons such as memory leaks, connection pool exhaustion, cache failure storms, and timing task conflicts, optimize code logic, set up a timeout retry mechanism, add current limit fuses, and regularly pressure measurement and evaluation resources.

As a system administrator, you may find yourself (today or in the future) working in an environment where Windows and Linux coexist. It is no secret that some big companies prefer (or have to) run some of their production services in Windows boxes an

Frankly speaking, I cannot recall the last time I used a PC with a CD/DVD drive. This is thanks to the ever-evolving tech industry which has seen optical disks replaced by USB drives and other smaller and compact storage media that offer more storage

In Linux systems, 1. Use ipa or hostname-I command to view private IP; 2. Use curlifconfig.me or curlipinfo.io/ip to obtain public IP; 3. The desktop version can view private IP through system settings, and the browser can access specific websites to view public IP; 4. Common commands can be set as aliases for quick call. These methods are simple and practical, suitable for IP viewing needs in different scenarios.

Built on Chrome’s V8 engine, Node.JS is an open-source, event-driven JavaScript runtime environment crafted for building scalable applications and backend APIs. NodeJS is known for being lightweight and efficient due to its non-blocking I/O model and
