Installing and Setting up a Valheim Server

All you need to know to install a Valheim server for you and your friends on a Linux server.

 

This tutorial uses: Ubuntu 20.04 LTS

Dependencies needed:

Below are all the dependencies needed for the tutorial to work. Make sure you have updated Linux by running sudo apt update and then installing the following dependencies by following the tutorial.

  • Git
 
1. Install Git

We will be installing Git so we can clone and download the auto-installer for the Valheim server.

sudo apt-get install -y git net-tools

 

2. Change to the /opt directory

We will be cloning the Git files to our /opt directory. The reason we are using /opt for cloning the Valheim server is because /opt is reserved for installation of application software.

Change to /opt with the following command:

cd /opt

 

3. Clone server files from Nimdy (Zero Bandwidth)

We are now going to clone the Valheim server installation script.

sudo git clone https://github.com/Nimdy/Dedicated_Valheim_Server_Script.git

 

4. Change directory to the newly cloned folder
cd Dedicated_Valheim_Server_Script/

 

5. Allow script to execute

Scripts are not executable right off the bat. We have to the file permission to be executable.

sudo chmod +x build_dedicated_valheim_server.sh

 

6. Change PASSWORDS and CHANGE ME AREAS before launching
sudo nano build_dedicated_valheim_server.sh

There are 4 things you need to change!
Minimum password length is 5 characters & password can't be in the server name.

  • userpassword=”user_password” password for the new Linux User it creates
  • password=”passw0rd” password for the Valheim Server Access
  • displayname=”server display name” Public display name for server
  • worldname=”111111111″ local inside world name

Save the file

 
7. Execute installation file
sudo ./build_dedicated_valheim_server.sh

 

8. A new version of /boot/grub/menu.lst promotx2 or DHCP – Accept Default (No)

Select keep the local version currently installed

 

9. Agree to Steam License Agreement
  • Select Ok
  • Select I Agree
  • Press Enter
 
10. Allow ports 2456, 2457, 2458 on your server
sudo ufw allow 2456:2458/udp

 

11. Stop Valheim service
sudo systemctl stop valheimserver.service

 

12. Reboot Server to test
sudo reboot

After the server reboot the valheimserver.service will automatically start on startup.

 

13. Once your server comes back online wait 2-5 mins and check Valheim service
sudo systemctl status valheimserver.service

If the server has not started run the following command to start the server manually:

sudo systemctl start valheimserver.service