Don't forget to change "YOURLOGIN" to your Steam login. And also correct the server name, port, world name and login password as desired.
for run steamcmd you must install glibc-32bit (example for opensuse):
zypper in -y glibc-32bit
steamcmd from repo don't work correctly
useradd valheim
mkdir /opt/{Steam,vh_srv}
cd /opt/Steam
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
./steamcmd.sh
valheim systemd service file /etc/systemd/system/valheim.service
[Unit]
Description=Valheim dedicated server
After=multi-user.target
[Service]
Type=simple
User=valheim
WorkingDirectory=/opt/vh_srv
Environment="LD_LIBRARY_PATH=/opt/vh_srv/linux64"
ExecStartPre=/opt/Steam/steamcmd.sh +login YOURLOGIN +force_install_dir /opt/vh_srv +app_update 896660 validate +exit
ExecStart=/opt/vh_srv/valheim_server.x86_64 -name "YOUR SERVER NAME" -port 2456 -world "YOUR_WORLD_NAME" -password "YOUR_STRONG_PASSWORD"
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
for the first time it is better to run the pre run command manually so as not to run into the system timeout:
cd /opt/vh_srv
export LD_LIBRARY_PATH=/opt/vh_srv/linux64
/opt/Steam/steamcmd.sh +login YOURLOGIN +force_install_dir /opt/vh_srv +app_update 896660 validate +exit
start & autostart
systemctl daemon-reload
systemctl enable --now valheim.service
UPD: for opensuse you can use package:
zypper ar --refresh obs://home:Werwolf2517 home:Werwolf2517
zypper --gpg-auto-import-keys refresh
zypper install -l -y valheim-server
configuration in file /etc/valheim.conf
:
STEAM_LOGIN="anonymous"
PORT="2456"
SERVER_NAME="Valheim dedicated server"
WORLD_NAME="ValheimWorld"
PASSWORD="00000000"
WARNING: the password cannot be shorter!!!
WARNING: if you use non default (anonymous) user for steamcmd you need sudo su - valheim
and login in to you account as this user.