What is Minecraft Forge?
Minecraft Forge is the most popular modding API for Minecraft Java Edition. It allows you to run thousands of community-created mods that add new content, mechanics, dimensions, and gameplay features. Running a Forge server lets you host modpacks like All the Mods, RLCraft, Create, and custom mod selections for your community.
System Requirements
- Minimum 4GB RAM (8GB+ recommended for large modpacks)
- 2+ CPU cores (4 cores recommended)
- SSD storage (modpacks can be 5-20GB)
- Java 17 or 21 depending on Minecraft version
Installing Java
# For Minecraft 1.20.x+ (Java 17+)
sudo apt update
sudo apt install -y openjdk-21-jre-headless
java -version
Installing Forge Server
# Create server directory
mkdir -p /opt/minecraft-forge && cd /opt/minecraft-forge
# Download Forge installer (check https://files.minecraftforge.net for latest)
wget https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.4-49.0.50/forge-1.20.4-49.0.50-installer.jar
# Run installer
java -jar forge-*-installer.jar --installServer
# Accept EULA
echo "eula=true" > eula.txt
Server Configuration
# server.properties
server-port=25565
max-players=20
view-distance=10
simulation-distance=8
motd=My Modded Server
online-mode=true
difficulty=normal
max-tick-time=120000
Memory and JVM Optimization
# Create start script with optimized JVM flags
cat > start.sh << EOF
#!/bin/bash
java -Xms4G -Xmx6G \
-XX:+UseG1GC \
-XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=200 \
-XX:+UnlockExperimentalVMOptions \
-XX:+DisableExplicitGC \
-XX:+AlwaysPreTouch \
-XX:G1NewSizePercent=30 \
-XX:G1MaxNewSizePercent=40 \
-XX:G1HeapRegionSize=8M \
-XX:G1ReservePercent=20 \
-XX:G1HeapWastePercent=5 \
-XX:G1MixedGCCountTarget=4 \
-XX:InitiatingHeapOccupancyPercent=15 \
-XX:G1MixedGCLiveThresholdPercent=90 \
-XX:G1RSetUpdatingPauseTimePercent=5 \
-XX:SurvivorRatio=32 \
-XX:+PerfDisableSharedMem \
-XX:MaxTenuringThreshold=1 \
-Dusing.aikars.flags=https://mcflags.emc.gs \
@libraries/net/minecraftforge/forge/1.20.4-49.0.50/unix_args.txt \
nogui
EOF
chmod +x start.sh
Installing Mods
# Download mods from CurseForge or Modrinth
# Place .jar files in the mods/ directory
mkdir -p mods
# For modpacks, download the server pack from CurseForge
# Extract and merge with your server directory
# Common performance mods to add:
# - Spark (profiling)
# - FerriteCore (memory optimization)
# - ModernFix (various fixes)
# - Chunky (pre-generate chunks)
Running as a Service
cat > /etc/systemd/system/minecraft-forge.service << EOF
[Unit]
Description=Minecraft Forge Server
After=network.target
[Service]
WorkingDirectory=/opt/minecraft-forge
ExecStart=/opt/minecraft-forge/start.sh
User=minecraft
Restart=on-failure
RestartSec=10
StandardInput=null
[Install]
WantedBy=multi-user.target
EOF
useradd -r -s /bin/false minecraft
chown -R minecraft:minecraft /opt/minecraft-forge
systemctl enable --now minecraft-forge
Firewall and Backups
# Open Minecraft port
sudo ufw allow 25565/tcp
# Automated backup script
cat > /opt/minecraft-forge/backup.sh << EOF
#!/bin/bash
BACKUP_DIR="/backup/minecraft"
mkdir -p "\$BACKUP_DIR"
tar czf "\$BACKUP_DIR/forge-\$(date +%Y%m%d-%H%M).tar.gz" \
--exclude="*.jar" /opt/minecraft-forge/world/
find "\$BACKUP_DIR" -name "*.tar.gz" -mtime +7 -delete
EOF
chmod +x /opt/minecraft-forge/backup.sh
echo "0 */6 * * * /opt/minecraft-forge/backup.sh" | crontab -
Troubleshooting
- Mod version mismatches: ensure all mods match your Forge and Minecraft version
- Out of memory: increase -Xmx value or remove heavy mods
- Tick lag: use Spark mod to profile and identify problematic mods
- Check logs/latest.log for crash reports and error details