How to Set Up a Dedicated Game Server on Debian 12 Bookworm System
Categories:
4 minute read
Hosting a dedicated game server allows you to provide a stable and customizable environment for multiplayer gameplay. Whether you’re setting up a server for friends or building a larger community, running your own server gives you control over performance, mods, and rules. This guide will walk you through the steps to set up a dedicated game server on a Debian 12 Bookworm system.
We’ll use Valheim and Minecraft as examples because they’re among the most popular server-hosted games, but the core principles apply to most dedicated servers.
1. System Requirements and Preparations
Before installing a game server, ensure your system meets the basic requirements:
Recommended Minimum Specs
Resource | Specification |
---|---|
CPU | Quad-core 2.4 GHz or better |
RAM | 8 GB (16 GB preferred) |
Storage | SSD with at least 20 GB free |
Network | Stable broadband connection |
OS | Debian 12 Bookworm (64-bit) |
Initial System Updates
Keep your system updated to avoid bugs and incompatibility:
sudo apt update && sudo apt upgrade -y
Also, install some common packages:
sudo apt install curl wget gnupg ufw software-properties-common unzip -y
2. Setting Up the Environment
Create a new user specifically for hosting the server. This adds a layer of security:
sudo adduser gameserver
sudo usermod -aG sudo gameserver
Switch to the user:
su - gameserver
Create directories to keep your server files organized:
mkdir ~/servers && cd ~/servers
3. Installing and Configuring the Game Server
3.1 Valheim Dedicated Server
Step 1: Install SteamCMD
SteamCMD is a command-line tool to install and update Steam games:
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install lib32gcc-s1 steamcmd -y
Create a directory for SteamCMD and symlink it:
mkdir ~/steamcmd
ln -s /usr/games/steamcmd ~/steamcmd/steamcmd.sh
Step 2: Install Valheim Server
Run SteamCMD to install the Valheim server:
cd ~/servers
mkdir valheim && cd valheim
~/steamcmd/steamcmd.sh +login anonymous +force_install_dir $(pwd) +app_update 896660 validate +quit
Step 3: Configure the Server
Create a shell script start_valheim.sh
to start your server:
nano start_valheim.sh
Paste the following:
#!/bin/bash
export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
export SteamAppId=892970
./valheim_server.x86_64 -name "My Valheim Server" -port 2456 -world "DedicatedWorld" -password "mypassword" -public 1
Make it executable:
chmod +x start_valheim.sh
3.2 Minecraft Server (Java Edition)
Step 1: Install Java
Minecraft requires Java. Install OpenJDK 17:
sudo apt install openjdk-17-jre-headless -y
Verify the version:
java -version
Step 2: Download Minecraft Server
cd ~/servers
mkdir minecraft && cd minecraft
wget https://launcher.mojang.com/v1/objects/$(wget -qO- https://launchermeta.mojang.com/mc/game/version_manifest.json | jq -r '.latest.release' | xargs -I {} curl -s https://launchermeta.mojang.com/mc/game/version_manifest.json | jq -r '.versions[] | select(.id=="{}") | .url' | xargs curl -s | jq -r '.downloads.server.url') -O server.jar
Note: You may need jq
for JSON parsing:
sudo apt install jq -y
Step 3: Accept EULA
echo "eula=true" > eula.txt
Step 4: Create Start Script
nano start_minecraft.sh
Paste:
#!/bin/bash
java -Xmx4G -Xms2G -jar server.jar nogui
Make it executable:
chmod +x start_minecraft.sh
4. Firewall and Port Forwarding
Configure the firewall with ufw
to allow game traffic:
sudo ufw allow OpenSSH
sudo ufw allow 2456:2458/udp # Valheim
sudo ufw allow 25565/tcp # Minecraft
sudo ufw enable
Also, ensure you port forward on your router for:
- Valheim: UDP 2456–2458
- Minecraft: TCP 25565
5. Running the Server as a Service
To keep your server running in the background and start on boot, create a systemd
service.
Example for Valheim
sudo nano /etc/systemd/system/valheim.service
Paste:
[Unit]
Description=Valheim Dedicated Server
After=network.target
[Service]
User=gameserver
WorkingDirectory=/home/gameserver/servers/valheim
ExecStart=/home/gameserver/servers/valheim/start_valheim.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl daemon-reexec
sudo systemctl enable valheim.service
sudo systemctl start valheim.service
Example for Minecraft
sudo nano /etc/systemd/system/minecraft.service
Paste:
[Unit]
Description=Minecraft Server
After=network.target
[Service]
User=gameserver
WorkingDirectory=/home/gameserver/servers/minecraft
ExecStart=/home/gameserver/servers/minecraft/start_minecraft.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl enable minecraft.service
sudo systemctl start minecraft.service
6. Monitoring and Maintenance
Checking Server Status
systemctl status valheim.service
systemctl status minecraft.service
Logs
Logs can be found via:
journalctl -u valheim.service
journalctl -u minecraft.service
Updates
- Valheim: Use SteamCMD to update
- Minecraft: Download the latest
server.jar
from the official source
Backups
Schedule regular backups using cron
and rsync
:
crontab -e
Add a rule like:
0 3 * * * rsync -a --delete /home/gameserver/servers/minecraft /home/gameserver/backups/
7. Security Tips
- Use strong passwords for server access.
- Avoid running the server as
root
. - Regularly update your system and server binaries.
- Use
fail2ban
to guard against brute-force SSH attacks. - Limit SSH to key-based login when possible.
8. Final Thoughts
Setting up a dedicated game server on Debian 12 Bookworm is a rewarding experience that gives you full control over multiplayer gameplay. Whether it’s hosting survival worlds in Minecraft or exploring Norse mythology in Valheim, your own server provides flexibility, customization, and stability.
With this guide, you’ve learned how to:
- Prepare your Debian system
- Install necessary dependencies
- Configure Valheim and Minecraft servers
- Set up secure services with
systemd
- Monitor and maintain the server for long-term use
This setup is highly adaptable. You can easily extend it to host other games like ARK: Survival Evolved, Terraria, CS:GO, and more using similar steps.
If you’re planning to host a public server, consider additional tools like Docker, failover mechanisms, or even cloud scaling solutions depending on your traffic. But for most users, a well-maintained Debian 12 box will serve as a rock-solid game server foundation.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.