How to install Leaf
By sheduxdev2 min read

Leaf Server Framework - Detailed Setup Guide
The Leaf Server Framework is a robust and lightweight solution designed specifically for hosting Minecraft servers. This guide provides a step-by-step walkthrough to help you set up and configure a Minecraft server using Leaf. Whether you are a developer or a server administrator, this framework offers unparalleled control and customization options.
What is Leaf?
Leaf is an open-source framework that prioritizes ease of use and efficiency in running Minecraft servers. It empowers users with advanced control and customization capabilities, making it an ideal choice for both developers and server administrators.
Steps to Set Up a Server with Leaf
1. First, download the latest version of Leaf from the official GitHub page: Leaf Releases.
2. After downloading, ensure that you have Java 21 or later installed. If you don't have Java installed, follow the instructions on this page: How to Install Java.
Server Setup for Linux
#!/bin/bashMEMORY=2048
restart() { if [ -f "logs/latest.log" ] { datetime=$(date +"%Y-%m-%d_%H-%M") mv "logs/latest.log" "logs/backup_${datetime}.log" }
echo "Starting Minecraft server with ${MEMORY}MB RAM..." java -Xms${MEMORY}M -Xmx${MEMORY}M \ --add-modules=jdk.incubator.vector \ -XX:+UnlockExperimentalVMOptions \ -XX:+UnlockDiagnosticVMOptions \ -XX:+UseG1GC \ -XX:+ParallelRefProcEnabled \ -XX:MaxGCPauseMillis=200 \ -XX:+DisableExplicitGC \ -XX:+AlwaysPreTouch \ -XX:G1HeapWastePercent=5 \ -XX:G1MixedGCCountTarget=4 \ -XX:InitiatingHeapOccupancyPercent=15 \ -XX:G1MixedGCLiveThresholdPercent=90 \ -XX:G1RSetUpdatingPauseTimePercent=5 \ -XX:SurvivorRatio=32 \ -XX:+PerfDisableSharedMem \ -XX:MaxTenuringThreshold=1 \ -XX:G1NewSizePercent=30 \ -XX:G1MaxNewSizePercent=40 \ -XX:G1HeapRegionSize=8M \ -XX:G1ReservePercent=20 \ -XX:+UseStringDeduplication \ -XX:+UseFastUnorderedTimeStamps \ -XX:+UseAES \ -XX:+UseAESIntrinsics \ -XX:+UseNUMA \ -XX:AllocatePrefetchStyle=1 \ -XX:+EnableVectorAggressiveReboxing \ -XX:+EnableVectorReboxing \ -XX:+EnableJVMCI \ -XX:+UseGCOverheadLimit \ -XX:+UseCodeCacheFlushing \ -jar server.jar --nogui if [ $? -eq 0 ] then echo "Server stopped normally. Waiting 1 second before restart..." sleep 1 else echo "Server crashed with exit code $? . Waiting 30 seconds before restart..." sleep 30 fi restart}
Start the script
restart
Server Setup for Windows
@echo off set MEMORY=2048:restart if exist "logs\latest.log" ( for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /value') do set datetime=%%I set timestamp=%datetime:~0,4%-%datetime:~4,2%-%datetime:~6,2%%datetime:~8,2%-%datetime:~10,2% move "logs\latest.log" "logs\backup%timestamp%.log" )
echo Starting Minecraft server with %MEMORY%MB RAM... java -Xms%MEMORY%M -Xmx%MEMORY%M ^ --add-modules=jdk.incubator.vector ^ -XX:+UnlockExperimentalVMOptions ^ -XX:+UnlockDiagnosticVMOptions ^ -XX:+UseG1GC ^ -XX:+ParallelRefProcEnabled ^ -XX:MaxGCPauseMillis=200 ^ -XX:+DisableExplicitGC ^ -XX:+AlwaysPreTouch ^ -XX:G1HeapWastePercent=5 ^ -XX:G1MixedGCCountTarget=4 ^ -XX:InitiatingHeapOccupancyPercent=15 ^ -XX:G1MixedGCLiveThresholdPercent=90 ^ -XX:G1RSetUpdatingPauseTimePercent=5 ^ -XX:SurvivorRatio=32 ^ -XX:+PerfDisableSharedMem ^ -XX:MaxTenuringThreshold=1 ^ -XX:G1NewSizePercent=30 ^ -XX:G1MaxNewSizePercent=40 ^ -XX:G1HeapRegionSize=8M ^ -XX:G1ReservePercent=20 ^ -XX:+UseStringDeduplication ^ -XX:+UseFastUnorderedTimeStamps ^ -XX:+UseAES ^ -XX:+UseAESIntrinsics ^ -XX:+UseNUMA ^ -XX:AllocatePrefetchStyle=1 ^ -XX:+EnableVectorAggressiveReboxing ^ -XX:+EnableVectorReboxing ^ -XX:+EnableJVMCI ^ -XX:+UseGCOverheadLimit ^ -XX:+UseCodeCacheFlushing ^ -jar server.jar --nogui
if %ERRORLEVEL%==0 ( echo Server stopped normally. Waiting 1 second before restart... timeout /t 1 /nobreak ) else ( echo Server crashed with exit code %ERRORLEVEL%. Waiting 30 seconds before restart... timeout /t 30 /nobreak )
goto restart
Start Your Server
- For Linux, run: ./start.sh
- For Windows, run: start.bat (or double-click the file)
- For Pterodactyl, click the "Start Server" button and your server will be ready.
Adding Plugins
If you wish to install plugins, you can follow the instructions here: How to Install Plugins.
Keep reading
- How to install PluginsHow to install plugins on a leaf server.
- How to install JavaHow to install java.

