How to Setup Valheim Dedicated Server - Linux

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey what's going on everybody today i'm going to show you how to set up a valheim dedicated server using linux now i found this game a couple days ago and i've already dumped a ton of time into it it is very addicting and i'm definitely addicted to it so i figured i would show you guys how to set up your own dedicated server so you can play with your friends now the game does have its own kind of server system built into it however it is kind of like a client-side hosted thing where if you're playing valheim and you're hosting the server people are only able to play in your world if you are playing in your world and online running it so that's where dedicated servers come in where you can kind of set them up and if you have the ability to run them 24 7 and you or your friends can connect to them whenever you want now this is part two in two videos that i'm putting out on how to make one of these the first video i did is how to set the server up using windows so if you are not running linux go ahead and check that video out however in this video i'm going to be using ubuntu 20.04.2 now i prefer ubuntu just because that's what i'm used to but the setup is going to be quite similar if you're using uh something different such as centos or arch linux now before we get started here i am going to just show you the two guides that i referenced for this video and that is the main steam cmd guide from the valve developer community and this just goes through the various commands and how to set up steem cmd and the other guide that i used is actually a post from silver knight on the steam forums and this just goes through the various steam cmd commands in order to install the valheim dedicated server now this post is centered around the windows installation however these commands are the same for the linux install because we're just installing steam cmd and the same commands you would use for steam cmd on windows still apply to steam cmd on linux so without further ado let's just jump into it now i'm assuming you already have a linux machine set up personally i use virtual machines and for this video i'm using virtualbox i am not going to go over how to set up virtualbox or linux on it but i am assuming that this is a fresh install and you haven't really done anything else with it so i'm just gonna go ahead and open up a putty window so we can see this better all right and we are in the server now since we're assuming this is a brand new install of linux we're going to go ahead and do the default first steps for any linux installation and that is going to be a pseudo app get update oh sudo apt up date my bad i didn't put the dash in there for the apt kit and once that is done we'll go ahead and do a pseudo apt upgrade just to get the latest versions of everything on our machine all right and now that we're up to date first thing we need to do is install steam cmd and if you need the guide just google steam cmd installation and i already showed you that guide earlier but it's the one from the valve developer community now an important note on this um is the 64-bit specific commands and that is in the guide that's linked in the description but more specifically the command to add i386 support so if we just try to do sudo apt install steam cmd at least on this distribution it's going to say that it has no installation candidate and that is because we're using a 64-bit system and we have not yet added the 386 architecture to it so in that guide you'll see four commands and that is a pseudo add apt repository multiverse we can go ahead and use that command however every time i've tried it it's already enabled for all sources so you really don't need to use that but the command that you do need to use is dpkg dash add dash architecture space i386 and this is what enables those i386 packages to be downloaded and ran on this machine now i think i kind of misspoke when i ran that command if you can see all these errors that i just got the command is sudo dpkg double dash add dash architecture space i386 and you should get no output um when you run that my issue way back here is i didn't do the double dash to begin with so that was my issue on that command and after we have enabled that we can go ahead and do another uh sudo apt update since now we technically have more packages that we can download in our repository we need to do another update and after that is done now we can do sudo apt install steam cmd and say yes to the extra 22 megabytes and click ok and agree to the license statement now if you are looking at the steam guide it does say to use the um apt install lib32 gcc one steam cmd you can use that it is the same package um because we enabled the i386 architecture the regular uh app to install steam cmd is going to download the same package so those two commands are interchangeable now once it's been installed we need to issue the command to install the valheim dedicated server now there are two ways to do this one of them is with a single command and the other is just by using the steamcmd console and i'll go ahead and just show you both and the first way i'm going to show you is just by using the steamcmd console so what we can do is just type in steamcmd and it's going to update steamcmd before it actually runs for the first time and once that is done now we have a different prompt that just says steam so at this point we are in steam cmd and we can issue our commands and the first one we're going to want to do is log in as anonymous and that is just login anonymous and it kind of broke up my input there but there's the command that i just used and it's already successfully logged on as anonymous now for the valheim server you do not have to actually log in with your real steam account i know there are some servers that kind of require that uh this is not one of them you can just use anonymous and it'll work just fine now the second command that we're going to use is to actually install the valheim dedicated server but there is one command that you might want to use first and that is force force underscore install underscore dir and following that we can specify where we want it to actually download these dedicated server files to now what i like to do is actually put this in the home folder because typically when i deploy a valheim server that's the only purpose of the machine so i'm going to go ahead and force install directory to home toasty and then a new folder called steam cmd under my home directory hit enter and then now we can issue the command to actually install the files to that directory and that is app underscore update and the code for the valheim dedicated server which is eight nine six six six zero and i'm gonna go ahead and put the validate keyword at the end there as well and hit enter and now it is downloading all of these files for the actual dedicated server to that install directory now like i said that force install directory command is optional if you don't put that in it's just going to put it under the default steam cmd folder and i'll show you where that's at once this is done downloading it's totally up to you i just like to put mine there in the home directory so it's right there when i'm ready to run it but it's really just preference all right now it says success app eight nine six six six zero is fully installed so at this point we can exit out of uh steam cmd and we are back to our main prompt now the other method that i was talking about is just a one command method to do all of that and it's just by using a plus symbol to just force all of the commands through steemcmd at the same time and what that looks like is steam cmd and then you do plus log in anonymous which is the first command we typed in then another space and plus force underscore install underscore dir space and then the directory that we set it up for and then another plus app underscore update the id of the valheim dedicated server the validate keyword then another plus and exit so if you look at this command it's really everything that we already did the only difference is that it's all on one line and all we have to do is press enter and it's going to go through all of them back to back to back just as we already did manually and you can see that that barely took any time because we've already done those commands and it's already installed so now that is done if we do a list we can see there's our steam cmd folder in the home directory that we forced it to go to and if we change directory down to that folder and do another list we can see all of our server files now before we configure the server to go i'm just going to show you how to get to the actual uh steam cmd folder and that is change directory root usr games and we'll go ahead and just go in there and do an ls yep cmd and i just tried to change the directory to the actual um executable steam cmd file which isn't going to work so if we didn't specify the uh force install directory it would install the dedicated server files under this folder instead which is where steam cmd is installed too usr games now let's go ahead change directory back to the home directory where our actual server files are go down into our steamcmd folder and take a look at these files now the only file that we're concerned with is this one called startserver.sh so we're just going to open that with the text editor of your choosing i like to use nano vi or vim works as well to use nano we're just going to type in nano start server dot sh and this is the contents of that file now the sections that are showing up in yellow are the ones that need to be changed or at least are recommended to be changed and by yellow i mean not the one on the echo line it's this line that we are concerned with this is the one that launches the server and you can see it's going to launch it with the valheim server program and then you've got this name port world and password configuration and these are the ones that we are concerned with changing this name my server is going to be how your server appears in the actual games server browser so name this whatever you want to show up as i'm going to name mine toasties server and make sure to keep the quotations around that and the next part is the a port and this is just the port that your game server is going to use for connections um this is a useful one to change if you're going to be running multiple servers on the same machine otherwise you can just leave it at the default 2456. now there are a few kind of caveats with that this is the port that we're going to use for port forwarding in the end and it goes in twos at least from what i've found the server will use two ports and that'll be 2456 and then the next one up so 2456 and 2457 will actually be the two ports that we'll need to forward and for any additional server that we add we'll just use the next two ports so if i wanted to set up another virtual machine with another valheim server i would start i would start that one using 2458 and then forward 24 58 and 24 59 and so on and so forth if i need more than one valheim server but for this we're just going to leave it at 2456 which is the default now the world area is really now i mean it doesn't matter that much this is just going to be the name of whatever world i don't believe that it has to do with the seed don't quote me on that it could very well be the seed for the world but i do know that if you're importing a world from another server to host it on this one the name of that world will need to match on this line but since we're creating a brand new one this doesn't matter i'm just gonna name it toasty world and the password you have to have one the default is secret if you want to leave it with default and just allow anybody to connect to it that's fine a lot of people know that the default password is secret but if you want to lock it down and only give out the password to uh who you want then go ahead and type in something different there i'm just going to change it to password now once this is done let's go ahead and save this which in nano is control x and then y and enter to overwrite that file and at this point we just need to launch that startup script which is going to be sh start server dot sh and this is going to do the initial startup of the server and this could take anywhere from a few seconds to 10 minutes typically your first time starting the server is going to take at least for me around five to six minutes to fully go through setting up um but each time you run it after that it's going to take probably just a few seconds and the command that we're looking for well not the command but the output we're looking for is either something to do with dungeons or a connections message and if you see this failed to initiate sdl thread priority manager just don't worry about it not entirely sure what that has to do with but i know that it doesn't really cause any issues and here we go we can see dungeon db start that is usually the second to the last command that shows up in the output sometimes the last one which is like server is connected or something like that sometimes that shows up sometimes it doesn't usually if you see this dungeon db start then the server is probably running so now we just need to for the port that we specified in order for it to be publicly accessible so let's get the ip address of the local machine now i already know mine because i ssh to it but if you don't know yours we're going to go ahead and suspend that process and put it in the background and run ifconfig and look for this ip address now if this is the first time using ifconfig on this brand new install you are going to have to do sudo apt install net dash tools not net dash tolls net tools come on net tools there we go and i already have it so we're going to take this ip address 10.13.13.147 and forward it on our router now this part of the setup is going to depend on what kind of router you have if you don't know how to port forward for your specific router look up the make and model of it and there's probably a guide out there for how to enable port forwarding but on mine i'm using a ubiquiti edge router so i'm going to go to the firewall nat tab and i'm going to remove the previous valheim rule that i already had in here i'm going to add a new one and the port that we're going to forward is going to be 2456 through 2457 and we're going to forward that to this address of our virtual machine so 13.147. 10.13.13.147 and we're going to put in the same port numbers for the forward two ports and just give it a description of valheim and apply now i'm just gonna go back to the server and place that process in the foreground and i'm actually going to restart it sometimes you need to restart it after port forwarding normally you don't have to but you know i've seen some weird stuff in my day so we're going to go ahead and just re-run this server command which is sh start server.sh go ahead and run it and this time it should only take a few seconds to get through all of these startup commands and there we go we can already see the dungeon db so we should be good to go now let's go ahead and open our steam server browser if you're not familiar with this window it is in the view menu of steam and it is called servers and we can sort by the valheim game and look for our map which we named in the configuration file uh toasty toasties server however i am pretty sure that this is not going to show up your mileage may vary on this part um typically when you host your own server out of your own home network it really depends on your networking equipment whether or not you're even able to see it in the public browser yourself however your friends should be able to see it here if it doesn't show up for you in the actual internet tab and all of the hosted servers you can go to favorites and manually add it i'm gonna go ahead and clear these out because those were the ones i used for my windows video and we're gonna add a server manually put in the ip 10.13.13.147 and the port number so two four five six and add this address to favorites do a refresh and we can see that it says not responding every time we refresh if you get this remove it and this is the purpose of those two ports and i'm honestly not sure why it does this but if you run into that just do two four five seven instead of two four five six and add that one to favorites and you can see it now shows up as toasty server so like i said it should automatically show up as toasty server in this list for everyone else except you unless you're lucky enough to have one of those uh routers that hairpin that actually works for which is another topic but from here we can right click on it and connect to server enter the password that we set in that configuration file which i just said as password and select our character and it should automatically take us into that server go ahead and enter the password again and we are now in our own dedicated server now it is a little unfortunate that you have to kind of go into it through the servers menu that way and it kind of sucks that it doesn't show up in the actual uh community list at least most of the time when you make this but that is the kind of the way around it to directly connect to it by ip address and usually every time i do it it does use that second port number the 2457 instead of 2456 for the local connection no idea why that is but that's just how i get it to work everybody else using this server it should work as normal it should show up in the list and there really should be no issue with that side of it as long as those ports are forwarded to the correct machine and that's really all there is on getting a valheim dedicated server set up using linux if you have any questions leave them in the comments below hopefully you learned something and as always happy networking you
Info
Channel: Toasty Answers
Views: 32,160
Rating: undefined out of 5
Keywords: Server, Steam, Valheim, Dedicated Server, SteamCMD, Linux, Ubuntu, Virtual Machine, Gaming, How to, Tutorial
Id: gVUlcsiPFxA
Channel Id: undefined
Length: 19min 55sec (1195 seconds)
Published: Wed Mar 03 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.