Skip to main content
Server administrator holding a laptop while explaining a setup

How to Set Up a Minecraft Forge Server

November 21, 2025 · Blog / Technical Guides

A Minecraft Forge server needs three things to agree: the Minecraft release, the Forge installer built for that release, and the Java major version required by that installer. Choosing the pair first prevents most launcher and mod-loading failures.

Use the official Forge downloads for the installer, read the Minecraft Java server guidance, and accept the Minecraft EULA only after reviewing it. Do not download server jars or mods from copied links in old tutorials.

Choose a compatible server build

Select the Minecraft release your players and mods require, then choose a Forge installer listed for that exact release. Read the installer page and release notes for its Java requirement before installing Java on the VPS. This procedure covers installers that generate an executable run.sh; if the selected installer does not generate that file, stop and follow its version-specific server instructions instead of adapting the service commands below.

Create a small record containing the Minecraft release, Forge installer filename, Java major version, and every mod filename. Use that record when updating or restoring the server so the components stay paired.

Prepare the VPS

Create a dedicated service account and server directory. The service account does not need interactive administrator access.

“`bash title="Create a Minecraft service account and update Apt indexes" sudo adduser –system –home /srv/minecraft –group minecraft sudo install -d -o minecraft -g minecraft -m 0750 /srv/minecraft sudo apt-get update


Install the Java runtime required by the selected Forge installer from the distribution repository. For example, if the installer documentation requires the package shown below, install it and verify the result before continuing:

```bash title="Install OpenJDK 21 and show its version"
sudo apt-get install -y openjdk-21-jre-headless
java -version

Do not reuse that package name when the selected installer requires another Java major version. A Java process starting successfully does not prove that it matches Forge or every mod.

Protect SSH before the game port

Keep an existing SSH session and provider-console access open. Allow SSH before enabling UFW, then allow the Minecraft Java server port only if the service is intended to be public:

“`bash title="Allow SSH and Minecraft through UFW" sudo ufw allow OpenSSH sudo ufw allow 25565/tcp sudo ufw enable sudo ufw status verbose


Restrict the provider firewall to known player addresses when practical. Do not open query, remote-console, or administration ports unless the feature is enabled, authenticated, and separately restricted.

## Install Forge from the official installer

Download the matching installer from the official Forge site to your own computer, verify that the HTTPS hostname is `files.minecraftforge.net`, rename the reviewed file to `forge-installer.jar`, and transfer it to `/srv/minecraft/`. Then run its server installation mode as the service account:

```bash title="Install Forge as the minecraft service account"
sudo chown minecraft:minecraft /srv/minecraft/forge-installer.jar
cd /srv/minecraft
sudo -u minecraft java -jar forge-installer.jar --installServer
sudo -u minecraft test -x /srv/minecraft/run.sh

The installer generates the launcher and libraries for that Forge build. Use the generated run.sh; do not guess a versioned runtime jar name from another guide.

Run the launcher once to create the server files, then stop after it reports that the EULA has not been accepted:

“`bash title="Run Forge once to generate server files" cd /srv/minecraft sudo -u minecraft bash ./run.sh nogui


Read the EULA and, if you accept it, write the required setting:

```bash title="Accept the Minecraft EULA"
sudo -u minecraft sh -c "printf 'eula=true\n' > /srv/minecraft/eula.txt"

Set memory and server options

Edit /srv/minecraft/user_jvm_args.txt, which the generated launcher reads, and set memory limits that leave capacity for the operating system. Do not allocate all VPS memory to Java.

Review server.properties before opening the server to players. Set the intended difficulty, view distance, whitelist behavior, and player limit. Keep remote console disabled unless it is required and protected with a strong secret plus firewall restrictions.

Install only mods published for the recorded Minecraft and Forge pair. Obtain them from the mod author's official project page or another source explicitly linked by that author, and preserve their filenames in the server record.

Run Forge with systemd

Create /etc/systemd/system/minecraft.service with the following unit:

“`ini title="Run Minecraft Forge with a systemd service" [Unit] Description=Minecraft Forge server After=network-online.target Wants=network-online.target

[Service] Type=simple User=minecraft Group=minecraft WorkingDirectory=/srv/minecraft ExecStart=/bin/bash /srv/minecraft/run.sh nogui Restart=on-failure RestartSec=10 TimeoutStopSec=120

[Install] WantedBy=multi-user.target


Load the unit and start it:

```bash title="Enable and start the Minecraft service"
sudo systemctl daemon-reload
sudo systemctl enable --now minecraft

Systemd sends a normal termination signal during stop and waits for the process. Do not use a detached screen command as both a service manager and a backup control path.

Need a self-managed VPS for a Forge server?

Compare Virtarix Cloud VPS options for a Minecraft Forge host that you configure, secure, monitor, and maintain.

Start and verify the server

Check the service and follow the server log while it loads:

“`bash title="Check Minecraft service logs and listening port" sudo systemctl –no-pager –full status minecraft sudo journalctl -u minecraft -n 100 –no-pager sudo ss -ltnp | grep ':25565'


A ready server remains active, reports its completed startup in the log, and listens on the intended port. Join with a client using the same Minecraft release and matching required mods before inviting other players.

If startup fails, stop the service and read the first exception in the log. Check Java, Forge, and mod compatibility before increasing memory or deleting world data.

## Back up and restore

Create a backup only after a clean stop so the world and configuration files are consistent. The following procedure records whether the service was running, restores that exact state after success or failure, verifies the archive before accepting it, and keeps the archive outside the server directory:

```bash title="Create and verify a state-aware Minecraft backup"
set -euo pipefail
BACKUP="/var/backups/minecraft/server-$(date -u +%Y%m%dT%H%M%SZ).tar.gz"
was_active=0
if sudo systemctl is-active --quiet minecraft; then
  was_active=1
fi
restore_service_state() {
  if [ "${was_active}" -eq 1 ]; then
    sudo systemctl start minecraft || true
  fi
}
trap restore_service_state EXIT
sudo install -d -o root -g root -m 0700 /var/backups/minecraft
if [ "${was_active}" -eq 1 ]; then
  sudo systemctl stop minecraft
fi
if ! sudo tar --create --gzip --file "${BACKUP}" --directory /srv minecraft; then
  sudo rm -f "${BACKUP}"
  exit 1
fi
if ! sudo tar --list --gzip --file "${BACKUP}" >/dev/null; then
  sudo rm -f "${BACKUP}"
  exit 1
fi
if [ "${was_active}" -eq 1 ]; then
  sudo systemctl start minecraft
  sudo systemctl is-active --quiet minecraft
fi
trap - EXIT

If archive creation or verification fails, the procedure removes the unusable file and the exit trap attempts to restore a previously running service. A service that was already stopped remains stopped. Investigate storage capacity or permissions before retrying, copy successful archives to a separate storage system, keep more than one recovery point, and test a restore in a temporary directory.

To restore, stop the service, preserve the damaged directory for investigation, extract the chosen archive to a temporary path, verify ownership and the recorded component versions, then replace the server directory and start the service. Never restore an archive over a running world.

Update without breaking the world

Make and test a clean backup before any Forge, Minecraft, Java, or mod change. Build the replacement in a separate directory using an installer for the chosen pair, copy only the intended world and configuration data, and test with a matching client before switching the service directory.

Change one layer at a time where possible. If the update fails, stop the new service and return to the preserved directory and recorded component set rather than deleting logs or regenerating the world.

Next steps

Monitor memory pressure, disk growth, restart frequency, and tick warnings.

Planning a modded Minecraft server?

Choose a Virtarix Cloud VPS with room for the operating system, Java, world data, mods, and peak player activity.

VPS S

For small sites, dev servers and Docker

$ 5 .50 /month
  • 3 cores
  • 6 GB
  • 50 GB NVMe
  • Unlimited
Get It Now
BEST SELLER

VPS M

For growing apps, websites and staging

$ 11 .40 /month
  • 6 cores
  • 16 GB
  • 100 GB NVMe
  • Unlimited
Get It Now
Peter French
About the Author Peter Frenchis the Managing Director at Virtarix, with over 17 years in the tech industry. He has co-founded a cloud storage business, led strategy at a global cloud computing leader, and driven market growth in cybersecurity and data protection.