This directory contains instructions and files for setting up a Minecraft server using native Linux systemd services. This approach offers maximum performance and control but requires more technical knowledge.
Audience: Intermediate to advanced users comfortable with Linux command line, systemd, and server administration.
- Working knowledge of command-line Linux (these instructions are geared toward Debian/Ubuntu)
- Ability to open ports in your firewall/router
- Root access to your Linux server
- Static IP or Dynamic DNS setup
- Dedicated server recommended (Minecraft can be CPU and memory intensive)
- Maximum Performance: Direct execution without containerization overhead
- Full System Integration: Native systemd service with proper logging and startup
- Multiple Server Support: Easy templating for running multiple game worlds
- Advanced Management: Direct access to all server files and configurations
- Scheduling Support: Built-in cron scheduling for parental controls
- Remote Management: RCON-based administration via included scripts
Install Java 21:
sudo apt-get update
sudo apt-get install openjdk-21-jdk-headlessVerify installation:
java -version
# Should show: openjdk version "21..." Create a dedicated system user for security:
sudo adduser --system --shell /bin/bash --home /opt/minecraft --group minecraftOption A: Download manually
- Download from https://www.minecraft.net/en-us/download/server/
- Place as
/opt/minecraft/server/server.jar
Option B: Use auto-download script
# Copy the download script
sudo cp download-server.sh /opt/minecraft/
sudo chmod +x /opt/minecraft/download-server.sh
# Create server directory and download
sudo mkdir -p /opt/minecraft/server
cd /opt/minecraft/server
sudo /opt/minecraft/download-server.shsudo chown -R minecraft:minecraft /opt/minecraftSwitch to minecraft user and generate initial files:
sudo su minecraft
cd /opt/minecraft/server
java -Xmx2048M -Xms256M -jar server.jar noguiWhen it stops (EULA not accepted), edit eula.txt:
echo "eula=true" > eula.txtStart again to generate world and configuration files:
java -Xmx2048M -Xms256M -jar server.jar noguiWhen you see [Server thread/INFO]: Done, type stop to shut down gracefully.
Edit server.properties with your preferred settings:
nano server.propertiesCritical settings:
white-list=true
pvp=false # Recommended for family servers
server-ip=x.x.x.x # Your server's IP
server-port=25565 # Unique port for each server
enable-rcon=true
rcon.port=25575 # Different from server-port
rcon.password=YourPassword # Choose a secure passwordCopy the service template:
sudo cp minecraft@.service /etc/systemd/system/
sudo systemctl daemon-reloadInstall build dependencies:
sudo apt-get install gcc git makeBuild and install mcrcon:
cd /opt/minecraft
sudo git clone https://github.com/Tiiffi/mcrcon
cd mcrcon
sudo make
sudo make installConfigure mcrcon:
sudo cp mcrcon.conf /etc/mcrcon.conf
sudo nano /etc/mcrcon.confEdit to match your settings:
RCON_PASSWD=YourPassword # Same as server.properties
SERVER_IP=x.x.x.x # Your server IP
server=25575 # Your rcon.portStart the service:
sudo systemctl start minecraft@serverCheck status:
sudo systemctl status minecraft@serverEnable auto-start:
sudo systemctl enable minecraft@serverFrom Minecraft Java Edition:
- Multiplayer → Add Server
- Server Address:
x.x.x.x:25565(replace with your IP:port)
Copy management script to server directory:
sudo cp manage.sh /opt/minecraft/server/
sudo chmod +x /opt/minecraft/server/manage.sh
sudo chown minecraft:minecraft /opt/minecraft/server/manage.shUse management console:
cd /opt/minecraft/server
./manage.shMake yourself an operator:
> op YourPlayerName
> Q
Add automatic start/stop schedule:
sudo crontab -eAdd these lines:
# Start server at 8 AM, stop at 8 PM
0 8 * * * systemctl start minecraft@server
0 20 * * * systemctl stop minecraft@serverThe systemd template makes it easy to run multiple servers:
-
Copy server directory:
sudo cp -r /opt/minecraft/server /opt/minecraft/creative
-
Edit new server's properties:
sudo nano /opt/minecraft/creative/server.properties
Change:
server-port=25566(different port)rcon.port=25576(different RCON port)level-name=creative_world(different world name)
-
Update mcrcon config:
sudo nano /etc/mcrcon.conf
Add:
creative=25576
-
Start second server:
sudo systemctl start minecraft@creative sudo systemctl enable minecraft@creative -
Open additional firewall ports for the new server port
minecraft@.service- systemd service templatemcrcon.conf- RCON configuration templatemanage.sh- Server management scriptwebsite.html- Parent information website templatedownload-server.sh- Automatic server download scriptdownload-server.ps1- Windows PowerShell download script
Service won't start:
sudo journalctl -u minecraft@server -fPermission errors:
sudo chown -R minecraft:minecraft /opt/minecraftRCON connection issues:
- Verify
enable-rcon=truein server.properties - Check rcon.port and rcon.password match mcrcon.conf
- Ensure RCON port is not blocked by firewall (internal use only)
Multiple server conflicts:
- Each server needs unique
server-portandrcon.port - Server directories must have different names
- Firewall must allow all server ports
- Backup Scripts: Add automated world backups via cron
- Monitoring: Integrate with system monitoring tools
- Resource Limits: Use systemd resource controls
- Logging: Centralized logging via journald
- Updates: Automated server jar updates via scripts
For the simpler Docker-based setup, see the ../quickstart/ directory.