Running a valheim server on vps is the simplest way to keep your Viking world online around the clock. Your friends can log in, build, and sail whenever they want, even when your own PC is off. You control the world, the mods, and who can join, for about the cost of a small VPS. This guide walks through the whole setup on Ubuntu 24.04, from picking the server to a world your group can actually play on.
What You Need Before You Start
Valheim is light for a survival game, but it still wants a machine that is always on, with enough RAM to hold the world in memory. A 2 vCPU VPS with 4 GB of RAM handles a group of up to 10 players without much trouble. If your group is larger, or you run heavy mods, go for 8 GB. Pick a location close to most of your players: ping matters more than raw CPU, since combat and building feel laggy above 100 ms. A 40 GB disk is plenty for the server, the world, and a few backups. You also need a copy of Valheim on Steam: the dedicated server files download through SteamCMD, and players connect with the same Steam account that owns the game.
If you are still deciding on specs, the sizing advice in our guide to how much VPS you need for self-hosting applies here too: buy for the players you actually have, not the ones you hope to get.
Valheim Server on VPS: Install SteamCMD and LinuxGSM
The fastest path for this valheim dedicated server setup is LinuxGSM, a script that installs, updates, and manages game servers. It handles the fiddly parts, like the SteamCMD install and the systemd service, so you can focus on the game settings. Start by updating the system and installing the tools LinuxGSM needs:
sudo apt update && sudo apt upgrade -y
sudo apt install curl wget file tar bzip2 gzip unzip bsdmainutils python3 util-linux ca-certificates binutils bc jq tmux netcat lib32gcc-s1 lib32stdc++6 -y
LinuxGSM refuses to run as root, so create a dedicated user and switch to it:
sudo adduser valheim
sudo su - valheim
Then download and run the installer:
wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh vhserver
./vhserver install
The installer downloads SteamCMD, pulls the Valheim dedicated server files, and asks for your server name and world name. Pick a name your friends will recognise, and keep the world name short: it becomes part of the save file name. The install takes a few minutes on a decent connection.
If you are nervous about breaking a live box, do this setup on a test machine or a snapshot first. The same habit applies to any big change, which is why we wrote a guide on how to clone a VPS server for testing before a big change.
Configure the Server and Open the Ports
Once installed, the server config lives in lgsm/config-lgsm/vhserver/vhserver.cfg. The settings most people change are the server name, world name, and password. Set a password: a public server with no password fills up with strangers fast, and there is no admin whitelist by default. Also set public="0" if you only want friends connecting by IP, or leave it public if you want random players to find it in the server browser.
Valheim needs two UDP ports open: 2456 for the game and 2457 for Steam. Add them to your firewall:
sudo ufw allow 2456/udp
sudo ufw allow 2457/udp
sudo ufw allow 2458/udp
Port 2458 covers the extra port LinuxGSM sometimes uses for the Steam query. If your provider has a separate cloud firewall panel, open the same ports there too: UFW alone will not help if the provider blocks traffic first. For the full firewall walkthrough, see our guide to setting up UFW firewall rules without locking yourself out.
Start the Server and Connect
Start it with a single command. A linuxgsm valheim server needs nothing more than this to boot:
./vhserver start
Give it a minute to load the world, then check it is listening:
./vhserver details
You should see the server name, the world name, and the player count. Players connect by choosing “Join Game”, then “Join IP”, and entering your VPS IP followed by :2456. If the server is public, it also shows up in the community server list, though the list can take a few minutes to pick it up.
To make the server start on boot, LinuxGSM can install a systemd service:
./vhserver install-service
After that, the server survives a reboot without you logging in. Check the logs with ./vhserver console when something looks wrong: most startup failures are a missing port or a bad password, and the log says so plainly.
Backups: The Part People Skip Until They Regret It
A Valheim world is a single set of save files, and one bad crash or a mistyped command can wipe months of building. LinuxGSM backs up with ./vhserver backup, which zips the world files into lgsm/backup. Schedule a valheim server backup with cron so it happens whether you remember or not:
0 4 * * * /home/valheim/vhserver backup >/dev/null 2>&1
That runs a backup every night at 4 a.m. Backups on the same disk do not save you from a dead disk, though. Copy them off the server regularly, for example with rsync to a second machine or an object storage bucket. Our guide to storing VPS backups off-site covers the options and the 3-2-1 rule in plain terms. Test a restore at least once: a backup you have never restored is a hope, not a plan.
Mods, Updates, and Performance
Vanilla Valheim is fine, but most long-running groups add mods through BepInEx, the mod loader the community uses. Install it on the server the same way you would on a client, then drop server-side mods into the BepInEx plugins folder. Keep the mod list small and documented: every mod can break after a game update, and a server that crashes on join kills the evening for everyone. Players need the same client-side mods installed, so share the list in your group chat.
When Iron Gate ships a Valheim update, update the server before anyone tries to join:
./vhserver stop
./vhserver update
./vhserver start
Clients on the new version cannot join a server on the old one, and the error does not always say so. If players lag, check the obvious first: run htop and look at RAM, not CPU. Valheim’s server is mostly single-threaded, so one busy core is normal. The usual real causes are a full disk, a world file that has grown huge after months of exploring, or a player building a base with thousands of pieces in one spot. Splitting up big bases helps more than a bigger VPS.
Valheim Server Ports and Common Problems
Most setup failures come down to a short list. “Server not responding” almost always means a port problem: check UFW, check the provider firewall, and confirm the server is actually running with ./vhserver details. If the server starts then stops, read the log before changing anything: a bad world name or a password with special characters the config file chokes on are common culprits. If friends can see the server but get kicked on join, the usual cause is a version mismatch after an update, or a password typo. If the server runs but nobody can find it in the browser, connecting directly by IP works fine while the listing catches up. Keep the LinuxGSM install updated with ./vhserver update-lgsm now and then so the management scripts do not fall behind the game.
Frequently Asked Questions
How much does it cost to run a Valheim server on a VPS?
Pricing varies by provider and region, so check official pricing first. As a rough guide, a 2 vCPU, 4 GB VPS from a budget provider usually costs a few dollars a month, and the server files are free if you already own the game on Steam.
Can I run a Valheim server and a website on the same VPS?
You can, but keep them separated. Give the game server its own user, and do not let a web app eat the RAM the game world needs. On a 4 GB box, a small static site is fine; a heavy WordPress install next to a busy Valheim world is asking for lag.
Do players need mods to join my modded server?
Only client-side mods. Pure server-side mods work without the player installing anything, but anything that changes visuals, UI, or items needs the same mod on the client. When in doubt, give every player the full mod list.
How many players can a 4 GB VPS handle?
Up to 10, which is Valheim’s official limit. A 4 GB VPS with 2 vCPUs holds that without strain; past that, the limit is the game itself, not your hardware.