Technology Encyclopedia Home >How to Set Up a Valheim Dedicated Server on a VPS — Viking Survival for Your Group

How to Set Up a Valheim Dedicated Server on a VPS — Viking Survival for Your Group

Valheim is one of those games where the multiplayer experience is fundamentally different from solo. The game expects you to coordinate with others, share the resource gathering, defend bases together. But trying to play when only one person can host, and the world disappears when they close the game, breaks the experience.

A dedicated server on a VPS keeps your world running continuously. Friends can join whenever they want, independently. The biomes you've explored stay explored. The mead you brewed stays brewed.

This guide sets up a Valheim dedicated server on Ubuntu 22.04, including the password configuration quirk that catches almost everyone on first setup.

I run game servers on Tencent Cloud Lighthouse. For Valheim, the 2 vCPU / 4 GB RAM plan handles a group of up to 10 players well. The region selection matters for a cooperative survival game — choose a data center close to where most of your group is located. Lighthouse's snapshot feature is also valuable for a long-running Valheim world: take a snapshot before major game updates (which sometimes require world migration or break mods) and you have a rollback point if the update causes problems.


Table of Contents

  1. Server Requirements
  2. Prerequisites
  3. Part 1 — Server Setup
  4. Part 2 — Install Valheim Dedicated Server
  5. Part 3 — Configure and Start the Server
  6. Part 4 — Run as systemd Service
  7. Part 5 — Open Firewall Ports
  8. Part 6 — Connect from the Game
  9. Part 7 — World Management and Backups
  10. The Gotcha: Server Password Cannot Be Blank
  11. Common Admin Tasks

  • Key Takeaways
  • Use the appropriate Lighthouse application image to skip manual installation steps where available
  • Lighthouse snapshots provide one-click full-server backup before major changes
  • OrcaTerm browser terminal lets you manage the server from any device
  • CBS cloud disk expansion handles growing storage needs without server migration
  • Console-level firewall + UFW = two independent protection layers

Server Requirements {#requirements}

Players RAM CPU
1–5 4 GB 2 vCPU
5–10 6 GB 2–4 vCPU
10+ 8 GB 4 vCPU

Valheim is not the most demanding server — 4 GB RAM handles most small groups fine.


Prerequisites {#prerequisites}

Requirement Notes
Cloud server Tencent Cloud Lighthouse Ubuntu 22.04
4 GB+ RAM
A copy of Valheim Players need the game on Steam

Cost: The Basic plan (~$6–8/month) works for small groups. Check current promotions.


Part 1 — Server Setup {#part-1}

ssh ubuntu@YOUR_SERVER_IP
sudo apt update && sudo apt upgrade -y

# SteamCMD requirements
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y lib32gcc-s1 steamcmd

# Dedicated user
sudo adduser --disabled-password --gecos "" valheim
sudo su - valheim

Part 2 — Install Valheim Dedicated Server {#part-2}

# As valheim user
/usr/games/steamcmd \
  +login anonymous \
  +force_install_dir ~/valheim-server \
  +app_update 896660 validate \
  +quit

ls ~/valheim-server/
# Should show: valheim_server.x86_64, valheim_server_Data/, etc.

exit   # Back to ubuntu user

Part 3 — Configure and Start the Server {#part-3}

Test launch (creates world and config directories):

sudo su - valheim
cd ~/valheim-server

# Start server manually to test
./valheim_server.x86_64 \
  -name "My Viking World" \
  -port 2456 \
  -world "Dedicated" \
  -password "yourpassword" \
  -public 1 \
  -savedir ~/.config/unity3d/IronGate/Valheim

Wait for: Game server connected — then Ctrl+C to stop.

exit   # Back to ubuntu user

Part 4 — Run as systemd Service {#part-4}

sudo nano /etc/systemd/system/valheim.service
[Unit]
Description=Valheim Dedicated Server
After=network.target

[Service]
Type=simple
User=valheim
WorkingDirectory=/home/valheim/valheim-server
ExecStart=/home/valheim/valheim-server/valheim_server.x86_64 \
  -name "My Viking World" \
  -port 2456 \
  -world "Dedicated" \
  -password "yourpassword" \
  -public 1 \
  -savedir /home/valheim/.config/unity3d/IronGate/Valheim
Restart=on-failure
RestartSec=20s

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable valheim
sudo systemctl start valheim

sudo journalctl -u valheim -f
# Wait for: Game server connected

Part 5 — Open Firewall Ports {#part-5}

Valheim uses 3 consecutive UDP ports starting from the configured port:

sudo ufw allow 2456/udp    # Game port
sudo ufw allow 2457/udp    # Query port
sudo ufw allow 2458/udp    # Used internally
sudo ufw allow ssh
sudo ufw enable

Open the same ports in the Lighthouse console firewall.


Part 6 — Connect from the Game {#part-6}

Option A: Add to Steam favorites

  1. Steam → View → Servers → Favorites → Add a Server
  2. Enter: YOUR_SERVER_IP:2456
  3. In Valheim: Join Game → filter by server name

Option B: Direct connect

  1. In Valheim main menu: Join Game
  2. Select your server
  3. Enter the password

Part 7 — World Management and Backups {#part-7}

World files are stored in:

/home/valheim/.config/unity3d/IronGate/Valheim/worlds_local/

Backup script:

sudo nano ~/backup_valheim.sh
#!/bin/bash
BACKUP_DIR=/home/ubuntu/backups/valheim
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p $BACKUP_DIR

sudo systemctl stop valheim
sleep 5

sudo tar czf $BACKUP_DIR/valheim_world_$DATE.tar.gz \
  /home/valheim/.config/unity3d/IronGate/Valheim/worlds_local/

sudo systemctl start valheim

find $BACKUP_DIR -mtime +7 -delete
echo "Valheim backup: $DATE"
chmod +x ~/backup_valheim.sh
(crontab -l; echo "0 5 * * * ~/backup_valheim.sh") | crontab -

The Gotcha: Server Password Cannot Be Blank {#gotcha}

Valheim dedicated servers require a password of at least 5 characters. If you leave -password "" empty or use a password shorter than 5 characters, the server starts but players cannot connect — they get kicked immediately after entering the password.

Also: the server password cannot match the world name. So if your world is named Dedicated, the password can't be Dedicated.

Set a meaningful password that you'll share with your group, and make sure it's at least 5 characters.


Common Admin Tasks {#admin}

# Update Valheim server
sudo systemctl stop valheim
sudo -u valheim /usr/games/steamcmd \
  +login anonymous \
  +force_install_dir ~/valheim-server \
  +app_update 896660 validate +quit
sudo systemctl start valheim

# Check who is connected (look in logs)
sudo journalctl -u valheim | grep "Got connection"

# Change map/world: edit ExecStart -world parameter, restart service
# Create a new world: change -world to a new name — Valheim generates it on first run

Troubleshooting {#troubleshooting}

Issue Likely Cause Fix
Connection refused Service not running or wrong port Check systemctl status SERVICE and verify firewall rules
Permission denied Wrong file ownership or permissions Check file ownership with ls -la and use chown/chmod to fix
502 Bad Gateway Backend service not running Restart the backend service; check logs with journalctl -u SERVICE
SSL certificate error Certificate expired or domain mismatch Run sudo certbot renew and verify domain DNS points to server IP
Service not starting Config error or missing dependency Check logs with journalctl -u SERVICE -n 50 for specific error
Out of disk space Logs or data accumulation Run df -h to identify usage; clean logs or attach CBS storage
High memory usage Too many processes or memory leak Check with htop; consider upgrading instance plan if consistently high
Firewall blocking traffic Port not open in UFW or Lighthouse console Open port in Lighthouse console firewall AND sudo ufw allow PORT

Frequently Asked Questions {#faq}

What server size do I need for a Valheim server?
Check the requirements section in this guide. Generally: more RAM = more players. Start with the recommended specs and monitor actual usage with htop before scaling up.

How do I keep the Valheim server running when I close my SSH session?
Use screen, tmux, or systemd to run the server as a background process. The guide covers setting up a systemd service for automatic startup and crash recovery.

How do I update the Valheim server software?
Stop the server, download the new version, replace the old binary or files, and restart. Always back up your world/save data first. Check the game's official documentation for version-specific migration notes.

How do I protect my server from unwanted players?
Use password protection and/or whitelist mode (if supported). Restrict the server port in UFW to known IP addresses if it's a private server for a small group.

What region should I choose for the server?
Choose the Lighthouse data center closest to where most of your players are located. Latency is directly tied to geographic distance from the server.

Start your Viking server:
👉 Tencent Cloud Lighthouse — Game server-ready VPS
👉 View current pricing and promotions
👉 Explore all active deals and offers