> For the complete documentation index, see [llms.txt](https://docs.ititanhosting.ro/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ititanhosting.ro/docs/english/vps/windows/how-to-set-up-a-game-server-on-windows-server.md).

# How to set up a game server on Windows Server

Running a game server on your Windows VPS is easier than you might think. Most popular games provide Windows server files that work right out of the box. This guide covers the two most requested options: Minecraft and FiveM.

### Before you start

Make sure you have:

* A Windows VPS with at least 4 GB of RAM (more for modded servers)
* Java installed (for Minecraft)
* The required ports opened in Windows Firewall

### Part 1: Installing Java (required for Minecraft)

Minecraft servers run on Java. Install the latest version:

1. Go to [adoptium.net](https://adoptium.net)
2. Download the **Temurin JDK 21** (LTS) for Windows
3. Run the installer with default settings
4. Verify it works:

```powershell
java --version
```

### Part 2: Setting up a Minecraft server

#### Step 1: Create a server folder

```powershell
mkdir C:\minecraft-server
cd C:\minecraft-server
```

#### Step 2: Download the server jar

1. Go to [minecraft.net/download/server](https://minecraft.net/download/server)
2. Right-click the download link and copy the URL
3. Download it on your VPS:

```powershell
curl -o server.jar https://piston-data.mojang.com/v1/objects/<version-hash>/server.jar
```

Or use the direct link for the latest release.

#### Step 3: Start the server

```powershell
java -Xmx2048M -Xms1024M -jar server.jar nogui
```

The server will start, then stop immediately. It needs you to accept the EULA first.

#### Step 4: Accept the EULA

```powershell
notepad eula.txt
```

Change `eula=false` to `eula=true`. Save and close.

#### Step 5: Start the server again

```powershell
java -Xmx2048M -Xms1024M -jar server.jar nogui
```

The server generates all necessary files and starts. You should see "Done!" in the console.

#### Step 6: Open the port

```powershell
netsh advfirewall firewall add rule name="Minecraft" dir=in action=allow protocol=TCP localport=25565
```

#### Step 7: Configure server properties (optional)

Edit the `server.properties` file with Notepad:

```powershell
notepad server.properties
```

Common settings to change:

| Setting                   | Default            | What it does                         |
| ------------------------- | ------------------ | ------------------------------------ |
| `max-players=20`          | 20                 | Maximum players allowed              |
| `motd=A Minecraft Server` | Message of the day |                                      |
| `difficulty=easy`         | easy               | `peaceful`, `easy`, `normal`, `hard` |
| `online-mode=true`        | true               | Set to `false` for cracked clients   |

#### Step 8: Keep the server running

The server stops when you close the terminal. Use a script or a tool like `nssm` to keep it running.

Create a start script. Save this as `start-minecraft.bat`:

```batch
@echo off
cd /d C:\minecraft-server
java -Xmx2048M -Xms1024M -jar server.jar nogui
pause
```

Double-click the batch file to run the server.

For a more robust solution, install it as a Windows service with NSSM:

```powershell
# Download nssm
curl -o nssm.zip https://nssm.cc/release/nssm-2.24.zip
Expand-Archive nssm.zip -DestinationPath C:\nssm

# Install Minecraft as a service
C:\nssm\win64\nssm.exe install Minecraft "C:\Program Files\Java\jdk-21\bin\java.exe" "-Xmx2048M -Xms1024M -jar C:\minecraft-server\server.jar nogui"
C:\nssm\win64\nssm.exe set Minecraft AppDirectory C:\minecraft-server
C:\nssm\win64\nssm.exe start Minecraft
```

### Part 3: Setting up a FiveM server

FiveM is a multiplayer modification for Grand Theft Auto V. The server files are maintained by the FiveM team.

#### Step 1: Download the server files

```powershell
mkdir C:\fivem-server
cd C:\fivem-server
curl -o server.zip https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/<latest-build-number>/server.zip
Expand-Archive server.zip -DestinationPath C:\fivem-server
```

Find the latest build number on [runtime.fivem.net/artifacts/fivem/build\_server\_windows/master](https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/).

#### Step 2: Configure the server

Create a `server.cfg` file in the server folder:

```powershell
notepad server.cfg
```

Add a basic configuration:

```
# Hostname
sv_hostname "ITITAN Hosting FiveM Server"

# Server identifier
sv_endpointprivacy 1
sv_endpointlisting 1

# Max players
sv_maxclients 32

# FiveM license key
sv_licenseKey "license"

# Resources directory
exec resources.cfg

# Start some default resources
start mapmanager
start chat
start spawnmanager
start sessionmanager
start basic-gamemode
start hardcap
start rconlog
start scoreboard
start playernames
start playerstates
```

#### Step 3: Get a license key

If you want your server to appear on the FiveM server list, you need a license key:

1. Go to [keymaster.fivem.net](https://keymaster.fivem.net)
2. Log in with your Cfx.re account
3. Register your server and get the license key
4. Add it to `server.cfg`

#### Step 4: Start the server

```powershell
cd C:\fivem-server
.\FXServer.exe +set serverProfile "default"
```

#### Step 5: Open the ports

```powershell
netsh advfirewall firewall add rule name="FiveM TCP" dir=in action=allow protocol=TCP localport=30120
netsh advfirewall firewall add rule name="FiveM UDP" dir=in action=allow protocol=UDP localport=30120
```

#### Step 6: Connecting to your server

In FiveM, open the console with F8 and type:

```
connect your-server-ip:30120
```

### Part 4: Basic server management

**Checking resource usage** Open Task Manager (`Ctrl + Shift + Esc`) to see how much CPU and RAM your game server is using.

**Updating the server** Stop the server, download the new files, and restart.

**Backups** Copy the entire server folder regularly. For Minecraft, back up the `world` folder. For FiveM, back up the entire server directory.

### Troubleshooting

**Server does not start** Check that Java is installed for Minecraft. For FiveM, make sure you extracted the files correctly.

**Players cannot connect** Verify the ports are open in Windows Firewall and not blocked by your hosting provider.

**Server runs out of memory** Increase the RAM allocation. For Minecraft, change the `-Xmx` value. For FiveM, the server automatically uses available RAM.

### Conclusion

You now have a game server running on your Windows VPS. Whether it is Minecraft or FiveM, the setup is straightforward and your players should be able to connect from anywhere.
