Running a Valheim and Minecraft Server on Dedicated Hardware

Take complete control over your multiplayer gaming experience by hosting your own robust, lag-free servers for Minecraft and Valheim on dedicated hardware.

proxmox

From Bare Metal to Building Worlds

Ubuntu

What Is a Dedicated Game Server (and Why Do You Need One)?

A dedicated game server is a specialized, standalone application running on hardware specifically set aside for hosting, rather than running in the background of the same personal computer a player is using to play the game. Unlike standard peer-to-peer hosting where the multiplayer world ceases to exist the moment the host logs off a dedicated server remains online 24/7. This persistent environment means your friends and community members can log in, gather resources, and progress at any time of day, completely independent of your personal gaming schedule or PC status.

For Minecraft, a dedicated server acts as the heavy-lifting central hub for your block-building universe. It handles all the complex background calculations, such as mob spawning, intricate redstone logic, chunk generation, and player data synchronization, which frees up the players' local computers to focus purely on rendering the graphics. Hosting Minecraft on dedicated hardware allows you to bypass the restrictive limitations of standard paid realms; it gives you the ultimate freedom to install massive custom modpacks, utilize performance-enhancing server software like PaperMC, and support dozens of concurrent players without suffering from severe lag or performance bottlenecks.

Similarly, a Valheim dedicated server provides a persistent, always-online Viking purgatory for you and your clan. Valheim's complex physics engine, smoke displacement, and structural integrity calculations can become incredibly taxing on a standard PC, particularly when multiple players are altering the landscape or engaging in chaotic boss fights simultaneously. By offloading this immense workload to a dedicated machine, you ensure a smooth, desync-free experience for everyone connected. It guarantees that your grand mead halls and sprawling settlements remain accessible and safe while bridging the gap seamlessly for cross-play between PC and console warriors.

Prerequisites

  • Dedicated Hardware: A spare computer, a rented bare-metal server, or a Virtual Private Server (VPS).
  • Sufficient RAM: At least 8GB of RAM is required, but 16GB or more is highly recommended if you intend to run both the Minecraft and Valheim servers simultaneously on the same machine.
  • Capable CPU: A modern multi-core processor (e.g., equivalent to an Intel Core i5 or AMD Ryzen 5 or higher) to handle simultaneous world simulations.
  • Fast Storage: At least 50GB of Solid State Drive (SSD) or NVMe storage. Fast read/write speeds are critical for quick world saves and fast chunk loading.
  • Operating System: A 64-bit Linux distribution. This guide is optimized for Ubuntu 22.04 LTS or 24.04 LTS, which is the industry standard for game hosting.
  • Network Requirements: A stable, high-speed broadband connection. If you are hosting this on a machine in your own home, you must have access to your router's administration panel to configure Port Forwarding.
  • Basic Technical Knowledge: Familiarity with using a command-line interface (CLI) and connecting to a machine remotely via SSH (Secure Shell).

Initial Security Setup

Before installing the game servers, you need to prepare the operating system, update packages, and configure the firewall.
1

Update the System

Log into your server via SSH and ensure all existing packages are up to date.
BASH
sudo apt update && sudo apt upgrade -y
2

Create a Dedicated User

Running servers as the root user is a major security risk. Create a dedicated user named gameserver .
BASH
sudo adduser gameserver
(Follow the prompts to set a strong password. You can leave the personal information fields blank by pressing Enter.)
3

Configure the Firewall (UFW)

You need to open the specific ports that Minecraft, Valheim, and your SSH connection use.
BASH
# Allow SSH so you don't lock yourself out
sudo ufw allow OpenSSH

# Allow Minecraft default port (TCP)
sudo ufw allow 25565/tcp

# Allow Valheim default ports (UDP)
sudo ufw allow 2456:2458/udp

# Enable the firewall
sudo ufw enable
4

Switch to the New User

For the rest of the installation, switch to your newly created user:
BASH
su - gameserver

Part 1: Setting up the Minecraft Server

Modern Minecraft (Java Edition 1.20.5+) requires Java 21 to run.
1

Install Java

Switch back to your sudo user momentarily (or prefix with sudo if you added gameserver to the sudoers list, though it's safer to run this as your admin user).
BASH
exit
sudo apt install openjdk-21-jre-headless -y
su - gameserver
2

Create the Directory and Download the Server

We will create a specific folder for Minecraft.
BASH
mkdir ~/minecraft
cd ~/minecraft
Download the server software. For best performance, it is highly recommended to use PaperMC instead of the Vanilla jar.
BASH
# Download the latest Paper 1.20.x build (replace URL with the latest build from papermc.io if needed)
wget -O server.jar https://api.papermc.io/v2/projects/paper/versions/1.20.4/builds/496/downloads/paper-1.20.4-496.jar
3

Accept the EULA

Minecraft requires you to accept their End User License Agreement before the server will start.
BASH
echo "eula=true" > eula.txt
4

Create a Startup Script

Create a script to define how much RAM the server is allowed to use.
BASH
nano start.sh
Paste the following code (adjust 4G to match your hardware's available RAM):
BASH
#!/bin/bash
java -Xms4G -Xmx4G -jar server.jar nogui
Save and exit (Ctrl+O , Enter , Ctrl+X). Make the script executable:
BASH
chmod +x start.sh

Part 2: Setting up the Valheim Server

Valheim runs via SteamCMD, which requires 32-bit architecture libraries to function properly on a 64-bit OS.
1

Install Dependencies and SteamCMD

Switch back to your admin/root user to install system packages:
BASH
exit
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install software-properties-common -y
sudo apt install lib32gcc-s1 steamcmd -y
(Note: During the steamcmd installation, you will be prompted to read and accept the Steam EULA. Use the Tab key to select "OK" and "I Agree", then press Enter .)
Switch back to the gameserver user:
BASH
su - gameserver
2

Download the Valheim Server Files

Create a directory and use SteamCMD to download the Valheim Dedicated Server (App ID 896660).
BASH
mkdir ~/valheim
cd ~/valheim
/usr/games/steamcmd +force_install_dir ~/valheim +login anonymous +app_update 896660 validate +quit
3

Configure the Valheim Startup Script

Valheim provides a template script. Let's copy it and edit it.
BASH
cp start_server.sh start_valheim.sh
nano start_valheim.sh
Look for the line that starts with ./valheim_server.x86_64 and modify the arguments. It should look like this:
BASH
export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
export SteamAppId=892970

# Edit the line below with your server details:
./valheim_server.x86_64 -name "My Epic Server" -port 2456 -world "Dedicated" -password "SecretPass123" -crossplay
  • -name: The name of your server as it appears in the server browser.
  • -world: The name of your save file (do not use spaces).
  • -password: Must be at least 5 characters long.
  • -crossplay: Allows Steam and Xbox players to play together.
Save and exit (Ctrl+O , Enter , Ctrl+X ). Make it executable:
BASH
chmod +x start_valheim.sh

Part 3: Running Servers in the Background (Systemd)

If you start your servers now, they will close as soon as you disconnect from SSH. To keep them running permanently and start them automatically if the physical server reboots, we need to create systemd services.
Switch to your admin user with sudo privileges:
BASH
exit
1

Create the Minecraft Service

BASH
sudo nano /etc/systemd/system/minecraft.service
Paste the following:
Ini, TOML
[Unit]
Description=Minecraft Dedicated Server
After=network.target

[Service]
User=gameserver
Group=gameserver
WorkingDirectory=/home/gameserver/minecraft
ExecStart=/home/gameserver/minecraft/start.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target
Save and exit.
2

Create the Valheim Service

BASH
sudo nano /etc/systemd/system/valheim.service
Paste the following:
Ini, TOML
[Unit]
Description=Valheim Dedicated Server
Wants=network-online.target
After=network-online.target

[Service]
User=gameserver
Group=gameserver
WorkingDirectory=/home/gameserver/valheim
ExecStart=/home/gameserver/valheim/start_valheim.sh
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
Save and exit.
3

Reload, Enable, and Start the Services

Apply the new configurations and start your game servers:
BASH
# Reload systemd to recognize the new files
sudo systemctl daemon-reload

# Enable them to start automatically on system boot
sudo systemctl enable minecraft.service
sudo systemctl enable valheim.service

# Start the servers right now
sudo systemctl start minecraft.service
sudo systemctl start valheim.service

Checking Server Status

To check if your servers are running properly without errors, you can view their live logs using the journalctl command:
  • For Minecraft: sudo journalctl -u minecraft -f
  • For Valheim: sudo journalctl -u valheim -f
(Press Ctrl+C to exit the live log view).
A Note on Home Hosting: If you are running this on a spare PC in your house rather than a rented VPS, you must log into your home router and set up Port Forwarding for ports 25565 (TCP) and 2456-2458 (UDP) pointing to your dedicated hardware's local IP address.

Discover CTCservers Dedicated Server Locations

CTCservers servers are available around the world, providing diverse options for hosting websites. Each region offers unique advantages, making it easier to choose a location that best suits your specific hosting needs.

Limited Time
Special Offers
Server upgrades & more.
UK Region London
15%
OFF
Asia Pacific Tokyo
10%
OFF