Starting a world with Start server ticked works for a quick session, but the world shuts down the moment the host quits. A dedicated server keeps it running so anyone in the group can sail out, build or farm on their own schedule.
Valheim's dedicated server is free on Steam, runs on Windows or Linux, and doesn't need its own copy of the game. This guide also covers moving the world you already have onto the server.
at a glance
- Server software
- Valheim Dedicated Server, Steam app
896660, free - Runs on
- Windows or Linux
- Default ports
2456and2457UDP- Configured with
- Launch options in the start script
- Hardware
- Light compared with most survival servers; more players and bigger bases need more RAM
- Time to set up
- About 30 minutes by hand, a few minutes with HostMode
Three ways to play Valheim together
Host from the game
Tick Start server when you load a world. Free and instant, but the world is only online while you're playing.
Dedicated server on your PC
Free software, always-on world. Costs only electricity, but you forward ports and handle updates. This guide.
A rented server
Pay monthly for someone else's hardware. Nothing to set up at home, less control over files and mods.
the manual way
Set up a Valheim server by hand
You'll install the server with SteamCMD, set the name, world and password in the start script, open two ports and connect. Commands are for Linux, with Windows differences in each step.
- 1
Install SteamCMD
On Ubuntu, SteamCMD needs the multiverse repository and 32-bit support. Run the server as a normal user, not root.
On Windows, download
steamcmd.zipfrom Valve's developer site, extract it to a folder such asC:\steamcmd, and runsteamcmd.exeonce so it updates itself.linuxsudo add-apt-repository multiverse sudo dpkg --add-architecture i386 sudo apt update sudo apt install steamcmd - 2
Download the Valheim server
The server installs with an anonymous login. On Windows, use a path like
C:\valheim, or install Valheim Dedicated Server from the Tools section of the Steam client.terminalsteamcmd +force_install_dir ~/valheim +login anonymous +app_update 896660 validate +quit - 3
Make your own start script
The install comes with
start_server.shon Linux andstart_headless_server.baton Windows. Updates overwrite those files, so copy the one for your system to a new name and edit the copy.Find the line that launches the server and set your own values.
-nameis what shows in the server list,-worldis the world's file name, and-passwordis what friends type to join. The password must be at least 5 characters and can't appear in the server name, or the server refuses to start.-public 1lists the server in the community browser; use-public 0to keep it private. On Windows the line starts withvalheim_server -nographics -batchmodeand takes the same options.terminalcp start_server.sh start_myserver.sh # in start_myserver.sh, edit the launch line: ./valheim_server.x86_64 -name "Our Valheim" -port 2456 -world "Midgard" -password "skal123" -public 1 - 4
Bring your existing world (optional)
To keep a world you've been playing, copy its two files,
Midgard.dbandMidgard.fwl(named after your world), from your gaming PC into the server's world folder, then set-worldto that name.On Windows, worlds are in
%USERPROFILE%\AppData\LocalLow\IronGate\Valheim\worlds_local. On a Linux server they go in~/.config/unity3d/IronGate/Valheim/worlds_local. Start the server once first if that folder doesn't exist yet. - 5
Open the firewall and forward the ports
Allow UDP 2456 and 2457 through the PC's firewall and forward both on your router to the PC's local IP. Reserve that IP in the router so the forward keeps working.
terminalsudo ufw allow 2456:2457/udp - 6
Start the server and join
Run your script with
./start_myserver.sh. In Valheim, pick your character, open the Join game tab, click Join IP, enter your public IP with the port (for example203.0.113.25:2456) and type the password.Stop the server with Ctrl+C in its window so it saves the world cleanly. On Linux, run it inside
tmuxorscreen, or as a systemd service, so it keeps going after you log out. - 7
Make yourself admin and keep it updated
Add your 17-digit SteamID64 to
adminlist.txt, which sits next to theworlds_localfolder, then restart. Admins can use kick, ban and save from the in-game F5 console.When Valheim updates, players on the new version can't join an old server. Stop it, rerun the SteamCMD command from step 2, and start it again. Back up
worlds_localbefore every update; the server also keeps a few automatic world backups there.
the easier way
Or let HostMode do the setup
HostMode runs the official Valheim server on your own PC and handles the install, updates and backups. The start script options become a settings form you can change from a browser or your phone.
- 1
Create a free account
Sign up at hostmode.net/register. The free Solo plan covers one machine and one server with every feature, so you can run this whole guide without paying anything.
- 2
Install the HostMode agent on your PC
The agent is a small Docker container that runs your game servers and connects out to the dashboard. On Linux, run the command below. It installs Docker if it's missing and asks for your license key, which you'll find under Licenses in the dashboard.
On Windows 10 or 11, open PowerShell and run
irm https://hostmode.net/downloads/install-windows.ps1 | iexinstead. It sets up WSL2 and Docker Desktop if you don't have them. Full details are in hostmode.net/docs/getting-started/installation.linuxbash <(curl -fsSL https://hostmode.net/downloads/install.sh) - 3
Add a Valheim server
In the dashboard, add a server and pick Valheim. The agent downloads and installs it, with 4 GB of RAM to start.
- 4
Fill in the settings
Server name, world name and password are fields, along with listing it publicly, crossplay, and a difficulty preset (casual, easy, normal, hard, hardcore, immersive or hammer). To bring an existing world, upload its
.dband.fwlfiles with the file manager or over SFTP. - 5
Forward the UDP ports shown and press Start
Each server gets its own block of ports; the dashboard shows the exact UDP ports to forward on your router. Press Start and send friends your address and password.
You also get Thunderstore mods installed from the dashboard, Save World and Force Update buttons, scheduled backups with restore, crash alerts and a Discord status board.
Free for 1 server · Linux & Windows · Runs on your hardware
World modifiers and difficulty
Valheim's world modifiers can be set from the start script. -preset hard applies one of the built-in presets (casual, easy, normal, hard, hardcore, immersive or hammer), and -modifier adjusts single settings, for example -modifier raids none to turn off base raids. Changes apply the next time the server starts.
Running mods on a Valheim server
Most Valheim mods use the BepInEx loader and are shared on Thunderstore. As a rule, the server and every player need the same mods and versions, or people get kicked or see desyncs. Install BepInEx on the server first, then the mods, and post the exact list for your group. HostMode installs Thunderstore mods on the server from the dashboard.
Troubleshooting
Friends can't connect from outside my house
Nine times out of ten this is the port forward. Check that UDP 2456 and 2457 is forwarded to the right local IP (the PC's address can change, so give it a reserved IP in your router), that the firewall on the PC allows it, and that you gave friends your public IP, not the 192.168 one.
The port forward is right but it still doesn't work
Compare the WAN or internet IP shown in your router with the IP a site like whatismyip.com shows. If they're different, or the router's starts with 100.64 to 100.127, your internet provider uses CGNAT and nobody outside can reach your PC directly. Ask your provider for a public IP (some do it free, some charge). No server panel, HostMode included, can get around CGNAT for you.
Friends can join but I can't, using my public IP
Many routers don't let you connect to your own public IP from inside your network. Join with the PC's local IP (for example 192.168.1.50) when you're at home, and give friends the public one.
The server closes right after starting
Check the password: it must be at least 5 characters and can't be part of the server name. Also make sure -world doesn't contain spaces you forgot to quote.
My world loaded empty
The -world name doesn't match the world's file names, so the server made a new world. Stop it, rename or set -world to match Midgard.db and Midgard.fwl exactly, and start again. Your original files are untouched.
Valheim server FAQ
Is the Valheim dedicated server free?
+
Yes. It's free on Steam and installs with an anonymous login, so you don't need a second copy of the game. On your own PC it costs only electricity.
What ports does a Valheim server need?
+
UDP 2456 and 2457 with the default -port 2456. The server uses the port you set and the one above it, so forward both.
How many players can join a Valheim server?
+
Valheim supports up to 10 players in one world, on a dedicated server or a hosted game.
How do I join my Valheim server by IP?
+
On the Join game tab, click Join IP and enter the address with the port, like 203.0.113.25:2456, then the password. From the same network, use the PC's local IP.
Can I use my single-player world on the server?
+
Yes. Copy the world's .db and .fwl files into the server's worlds_local folder and set -world to the same name. Characters stay with each player, so everyone keeps their gear.
Do I need to port forward?
+
Yes. Players connect directly to your PC, so the ports must be forwarded on your router, or the PC needs a public IP. That's the same with HostMode.



