Port forwarding
Open ports (udp)
2456 2457 2458 27060
Uncomplicated Firewall
sudo ufw allow 2456/udp
sudo ufw allow 2457/udp
sudo ufw allow 2458/udp
sudo ufw allow 27060/udp
Setup SteamCMD
Add multiverse repo
sudo add-apt-repository multiverse
Add i386 architecture
sudo dpkg --add-architecture i386
Update and install SteamCMD
sudo apt update && sudo apt install lib32gcc1 steamcmd
Install server files
Make a new folder in your home directory example /home/tattoine/valheim
mkdir valheim && cd valheim
Install Valheim server files (change directory/username)
/home/tattoine/.steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir /home/tattoine/valheim +app_update 896660 validate +exit
Create your own start script (use your preferred editor)
nano start_valheim.sh
Paste below to start_valheim.sh (change directory/username)
#!/bin/bash
export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
export SteamAppId=892970
# Tip: Make a local copy of this script to avoid it being overwritten by steam.
# NOTE: Minimum password length is 5 characters & Password cant be in the server name.
# NOTE: You need to make sure the ports 2456-2458 is being forwarded to your server through your local router & firewall.
/home/tattoine/.steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir /home/tattoine/valheim +app_update 896660 +quit
./valheim_server.x86_64 -name "Banana Fury" -port 2456 -nographics -batchmode -world "Dedicated" -password "hello123" -public 1 > /dev/null &
export LD_LIBRARY_PATH=$templdpath
echo "Server started"
Setting execute permissions
chmod +x start_valheim.sh
Create a service script (use your preferred editor)
nano valheim.service
Paste below to start_valheim.sh (change directory/username)
[Unit]
Description=Valheim service
Wants=network-online.target
After=syslog.target network.target nss-lookup.target network-online.target
[Service]
Type=simple
Restart=on-failure
RestartSec=10
StartLimitInterval=60s
StartLimitBurst=3
User=steam
Group=steam
ExecStartPre=/home/tattoine/.steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir /home/tattoine/valheim +app_update 896660 validate +exit
ExecStart=/home/tattoine/valheim/start_valheim.sh
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGINT
WorkingDirectory=/home/tattoine/valheim
LimitNOFILE=100000
[Install]
WantedBy=multi-user.target
Copy the service script to systemd and reload the deamon
sudo cp valheim.service /etc/systemd/system && sudo systemctl daemon-reload
Service Start/Stop/Status
sudo systemctl start valheim
Extras
Add service on system boot
sudo systemctl enable valheim.service
Get Steam64ID (one user per row)
nano ~/.config/unity3d/IronGate/Valheim/adminlist.txt
Server Commands
Only whitelisted admins can use commands, Open console with F5
Command | Args | Description |
---|---|---|
help | Lists all the commands you can use | |
kick | name/ip/userID | Kick the user |
ban | name/ip/userID | Ban the user |
unban | /ip/userID | Unban the user |
banned | List banned users | |
ping | Send a ping to the server to get your latency | |
lodbias | 1 | Set distance lod bias. If empty shows actual lodbias. By default 1.5 |
info | System info |
This is legit! I got it up and running in less than 20 minutes. Couldn't find the mutliversea repo. Also the steamcmd command executable was installed to '/usr/games/steamcmd' on Ubuntu 20.04.2 LTS. Last thing, I didn't have a 'steam' user so i just used my regular user and group and it works great. Thanks!