Valheim Dedicated Server: A Comprehensive Guide to Setting Up Your Own Server

Running a dedicated server for Valheim is the perfect way to create a persistent and always-accessible world for you and your friends to explore, build, and conquer together. Unlike playing as a hosted game, a dedicated server allows your Valheim world to remain online even when the original host is offline, ensuring that your Viking adventures can continue at any time. Setting up a Valheim Dedicated Server involves a bit of initial configuration, but this guide will walk you through each step, making the process straightforward and manageable.

This guide will provide you with detailed instructions on how to download, configure, and run your own Valheim dedicated server. We’ll cover everything from downloading the server program via Steam to understanding crucial server settings and even exploring advanced options like using Docker. While we’ll provide guidance on the server software itself, please note that router configurations can vary significantly. For specific instructions on port forwarding, you should consult your router’s manual or your Internet Service Provider (ISP). Let’s dive into setting up your Valheim dedicated server and get your Viking world online!

Downloading the Valheim Dedicated Server Program from Steam

The first step to hosting your own Valheim dedicated server is to download the server software itself. Steam makes this process very easy. Here’s how:

  1. Open your Steam Library: Launch the Steam client and navigate to your Library.
  2. Enable Tools View: At the top left of your Library, you’ll see a dropdown menu. Click it and ensure that the “Tools” checkbox is selected. This will make Steam’s tools, including dedicated server programs, visible in your library.
  3. Find Valheim Dedicated Server: Scroll through your Library list until you find “Valheim Dedicated Server.” It will have a distinctive server icon.
  4. Install the Server: Click on “Valheim Dedicated Server” and then click the “Install” button. Steam will download and install the necessary files to your computer.

Once the download is complete, you’re ready to move on to configuring your server.

Configuring and Running Your Valheim Dedicated Server

After downloading the Valheim dedicated server software, the next crucial step is configuring it. This involves editing a configuration file to set up your server’s name, password, world, and other important settings.

  1. Navigate to the Installation Folder: The easiest way to find your Valheim dedicated server installation folder is through Steam. Right-click on “Valheim Dedicated Server” in your Steam Library, go to “Manage,” and then select “Browse local files.” This will open the folder where the server files are located.

  2. Locate start_headless_server.bat (or start_server.sh for Linux): In the installation folder, you will find a file named start_headless_server.bat if you are on Windows, or start_server.sh if you are using Linux. This is the script that launches your server.

  3. Create a Copy (Recommended): It’s highly recommended to create a copy of this file (e.g., rename it to my_valheim_server.bat). This is because the original start_headless_server.bat file can be reset whenever the Valheim dedicated server software updates through Steam, potentially overwriting your custom settings. Editing a copy ensures your configurations are preserved through updates.

  4. Edit the Configuration File: Right-click on your copied .bat file (or the original if you didn’t make a copy) and select “Edit.” This will open the file in a text editor like Notepad. (On Linux, you can use a text editor or nano or vim in the terminal to edit start_server.sh).

  5. Understand Server Properties: Open the file and look for the line that starts with start valheim_server. This line contains all the server properties you need to configure. These properties control various aspects of your Valheim dedicated server, including:

    • -name "My Server": Sets the name of your server as it will appear in the Valheim server list. Replace "My Server" with your desired server name.
    • -port 2456: Defines the primary port your server will use for communication. The default port is 2456. Valheim uses this port and the next one (port+1), so in this case, ports 2456 and 2457 are used. Important Note: For Steam backend servers, you’ll need to configure port forwarding on your router to allow external connections to your server on these ports (2456-2457 by default). If you are using the Crossplay backend (explained below), port forwarding is generally not required.
    • -world "Dedicated": Sets the name of the Valheim world your server will host. If a world with this name doesn’t exist, a new one will be created. If it does exist, the server will load that existing world.
    • -password "Secret": Sets the server password. Replace "Secret" with a strong password to protect your server.
    • -public 1: Determines server visibility. 1 (default) makes your server public and visible in the in-game server browser. 0 makes it private, only joinable via direct IP address and port.
    • -crossplay: Adding this parameter enables Crossplay functionality. Crossplay servers use relay servers and generally do not require port forwarding. Players from different platforms can join Crossplay servers using a join code, public IP, or server list. Note that local IP or loopback IP connections are not possible with Crossplay servers. If you omit -crossplay, the server will use the Steam backend, limiting connections to Steam users and requiring port forwarding for external access.
    • -savedir [PATH]: Allows you to override the default save location for world data and permission files (adminlist.txt, bannedlist.txt, permittedlist.txt).
    • -logFile "d:log.txt": Specifies the path and filename for saving server logs.
    • -saveinterval 1800: Sets the world save interval in seconds. The default is 1800 seconds (30 minutes).
    • -backups 4, -backupshort 7200, -backuplong 43200: Configure automatic backups. -backups sets the number of backups to keep. -backupshort is the interval for the first backup (default 2 hours). -backuplong is the interval for subsequent backups (default 12 hours).
    • -instanceid "1": Useful for running multiple servers from the same machine. Set a unique ID for each server to ensure unique PlayFab IDs, especially for Crossplay.
    • -preset hard, -modifier raids none, -setkey nomap: These options allow you to use world modifiers to customize your Valheim experience. You can set presets like Casual, Easy, Hard, Hardcore, etc., or individually adjust modifiers for combat difficulty, death penalty, resource availability, raid frequency, portal restrictions, and more. Checkboxes like nobuildcost, playerevents, passivemobs, and nomap can also be toggled using -setkey.
  6. Save Your Configuration: After editing the desired properties, save the .bat file (or .sh file).

  7. Start the Server: You can now start your Valheim dedicated server by double-clicking your modified .bat file (or running ./start_server.sh in a Linux terminal). Alternatively, you can launch it through Steam by right-clicking “Valheim Dedicated Server” and selecting “Launch.”

  8. Windows Firewall: If you are running the server on Windows for the first time, you might see a Windows Firewall popup. Ensure you check all checkboxes to allow the Valheim dedicated server to communicate through your firewall and access the internet.

  9. Server Ready Message: Once the server starts successfully, you will see the message “Game server connected” in the server console window. This indicates that your Valheim dedicated server is up and running and ready for players to join.

Stopping Your Valheim Dedicated Server Properly

When you are finished running your Valheim dedicated server, it’s essential to shut it down correctly to prevent potential data corruption or server issues. Do not simply close the server window by clicking the “X” button.

To properly stop your Valheim dedicated server, press CTRL+C in the server console window. This will initiate a clean shutdown process, ensuring that the server saves the world state correctly and closes down all processes. Closing the window directly might leave the server running in the background, which is not recommended.

Server Administration: Admins, Bans, and Permissions

Managing your Valheim dedicated server includes controlling who has administrative privileges, banning unwanted players, and creating a whitelist for private servers. You can manage these aspects through text files located in your server’s save data directory.

These files are:

  • adminlist.txt: Lists players with admin privileges.
  • bannedlist.txt: Lists players who are banned from the server.
  • permittedlist.txt: Lists players who are allowed to join the server (whitelist). Important: If you use the permittedlist.txt, only players on this list will be able to join. Everyone else will be effectively banned.

To manage these lists:

  1. Locate the Save Path: The default save path for these files is:
    • Windows: ../%USERPROFILE%/AppData/LocalLow/IronGate/Valheim
    • Linux: ~/.config/unity3d/IronGate/Valheim
      You can also override this default path using the -savedir server command-line argument.
  2. Edit the Text Files: Open the adminlist.txt, bannedlist.txt, or permittedlist.txt file with a text editor.
  3. Add Player IDs: Add one Platform User ID per line in each file. You can find a player’s Platform User ID in the server log or within the game by pressing F2. The ID format is [Platform]_[User ID] (case-sensitive), for example, Steam_76561198000000000.

In-Game Admin Commands:

As an admin, you can also use in-game console commands to manage players directly. To access the console, press F5 in-game. The following commands are available:

  • kick [PLAYERNAME]: Disconnects a player from the server.
  • ban [PLAYERNAME]: Bans a player from the server, adding them to bannedlist.txt.
  • unban [PLAYERNAME]: Removes a player from the ban list (bannedlist.txt).
  • banned: Lists all currently banned players in the console.

Running Valheim Dedicated Server on Linux: Required Packages

If you are setting up your Valheim dedicated server on a Linux system, you might need to install some additional packages to ensure the server runs correctly. The Linux Steam client shares many library requirements with the Valheim server, but these additional packages are often necessary:

  • libatomic1: https://pkgs.org/download/libatomic1 (or install via your distribution’s package manager, e.g., sudo apt-get install libatomic1 on Debian/Ubuntu).
  • libpulse-dev: (e.g., sudo apt-get install libpulse-dev)
  • libpulse0: https://pkgs.org/search/?q=libpulse0 (or install via your distribution’s package manager, e.g., sudo apt-get install libpulse0).

Use your Linux distribution’s package manager (like apt, yum, dnf, pacman, etc.) to install these packages.

Advanced Option: Running Valheim Dedicated Server with Docker

For users running older Linux distributions that may not meet the GLIBC and GLIBCXX library version requirements of the Valheim dedicated server, Docker provides a convenient alternative to system upgrades. Docker allows you to run the server in a containerized environment with the necessary libraries, isolating it from your host system’s libraries.

Prerequisites:

  • Install Docker: Most Linux distributions include Docker packages. Installation instructions for various distributions can be found here: https://docs.docker.com/engine/install/.
  • Docker Daemon Running: Ensure the Docker daemon is running. You can check this by running docker ps. If you see an error like “Cannot connect to the Docker daemon,” Docker is not running and needs to be started (usually with sudo systemctl start docker or similar, depending on your system).
  • Docker Permissions: Make sure the user running the Valheim dedicated server is allowed to use Docker. Typically, this involves adding the user to the docker group (e.g., sudo usermod -aG docker yourusername). You may need to log out and log back in for group changes to take effect.

Using the docker_start_server.sh Script:

The Valheim dedicated server package includes a docker_start_server.sh script in the same directory as start_server.sh. This script simplifies running the server within a Docker container.

  1. Run the Docker Script: Execute the docker_start_server.sh script, passing your server startup script (start_server.sh or your customized copy) as an argument:

    ./docker_start_server.sh start_server.sh
  2. Initial Container Build: The first time you run the script, it will build the Docker container environment. This may take a few minutes as it downloads necessary images and sets up the container. Subsequent runs will start much faster.

  3. Game Data Volume: The docker_start_server.sh script uses a Docker volume to store game data persistently. By default, this volume is named valheim_server_data. You can customize this volume name or even map a directory on your host filesystem to store the data.

  4. Customizing Data Storage: To store game data in a specific directory on your host system (e.g., your home directory in a folder named valheim_storage), modify the DOCKER_DATA_VOLUME variable in the docker_start_server.sh script:

    DOCKER_DATA_VOLUME="${HOME}/valheim_storage"

    Important: If you change DOCKER_DATA_VOLUME to a host path, ensure the directory exists before running the script. Worlds, adminlist.txt, bannedlist.txt, and permittedlist.txt will be stored in this location.

  5. Stopping the Dockerized Server: Stop the Dockerized Valheim dedicated server in the same way you would stop a server running directly on the host machine: by pressing CTRL+C in the console window.

By following these steps, you’ll have your own Valheim dedicated server up and running, ready to host epic Viking adventures for you and your friends! Remember to explore the various server configuration options to tailor your server to your preferred gameplay experience.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *