Port forwarding
Open ports (udp)
2456 2457 2458 27060Uncomplicated Firewall
sudo ufw allow 2456/udp
sudo ufw allow 2457/udp
sudo ufw allow 2458/udp
sudo ufw allow 27060/udpSetup SteamCMD
Add multiverse repo
sudo add-apt-repository multiverseAdd i386 architecture
sudo dpkg --add-architecture i386Update 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 valheimInstall Valheim server files (change directory/username)
/home/tattoine/.steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir /home/tattoine/valheim +app_update 896660 validate +exitCreate your own start script (use your preferred editor)
nano start_valheim.shPaste 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.shCreate a service script (use your preferred editor)
nano valheim.servicePaste 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.targetCopy the service script to systemd and reload the deamon
sudo cp valheim.service /etc/systemd/system && sudo systemctl daemon-reloadService Start/Stop/Status
sudo systemctl start valheimExtras
Add service on system boot
sudo systemctl enable valheim.serviceGet Steam64ID (one user per row)
nano ~/.config/unity3d/IronGate/Valheim/adminlist.txtServer 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 |
Hello, thanks very much, but my systemd reload every time, do you know why?