with LinuxGSM + Valheim Mod Manager (fork)
This repository documents how to set up a modded Valheim server. It has been tested on Proxmox 9 with a Debian 13 container, but it works on any Linux that the LGSM supports.
- Fully automated server management with LinuxGSM
- Mod support using BepInEx via Valheim Mod Manager (fork)
- Clean separation of configs and update-proof BepInEx wrapper
- Easy world backups and client mod export
- Cron jobs for health monitoring and automatic updates
Run as root:
dpkg --add-architecture i386
apt update && apt -y upgrade
apt install -y \
bc binutils bsdmainutils distro-info jq \
lib32gcc-s1 lib32stdc++6 libatomic1 libc6-dev libc6:i386 \
libpulse-dev libsdl2-2.0-0:i386 \
netcat-openbsd pigz tmux unzip uuid-runtime \
curl wget ca-certificates file xz-utils bzip2 python3 \
mc nano \
python3-packaging python3-magic python3-paramiko python3-dateutil git
# Create a dedicated user
adduser vhserverSwitch to the service user:
su - vhserverDownload LinuxGSM and install Valheim server:
curl -Lo linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh vhserver
./vhserver installClone my fork:
git clone https://github.com/triuk/Valheim-Mod-Manager.gitCreate a launcher:
printf '%s\n' '#!/bin/sh' 'SCRIPT_DIR="$(cd -- "$(dirname -- "$(readlink -f -- "$0")")" && pwd -P)/Valheim-Mod-Manager"' 'cd "$SCRIPT_DIR" || exit 1' 'exec python3 ./cli.py "$@"' > vhserver-mods && chmod +x vhserver-modsInstall BepInEx:
./vhserver-modsChoose:
2: Install New Mod → BepInExPack_Valheim (denikson)
Q: Quit
Copy and fix the startup wrapper:
cp -p serverfiles/start_server_bepinex.sh serverfiles/start_server_bepinex_local.sh
sed -i 's|^exec ./valheim_server\.x86_64.*|exec ./valheim_server.x86_64 "$@"|' serverfiles/start_server_bepinex_local.shEdit config:
nano lgsm/config-lgsm/vhserver/vhserver.cfgExample:
servername="MyAwesomeServer"
serverpassword="strongPassword"
worldname="MyNeatWorld"
port="2456"
# public="1"
# maxplayers="10"
executable="./start_server_bepinex_local.sh"Start:
./vhserver startDetails:
./vhserver detailsDebug:
./vhserver debugEdit crontab as vhserver user:
crontab -eAdd:
@reboot /home/vhserver/vhserver start >/dev/null 2>&1
#*/5 * * * * /home/vhserver/vhserver monitor > /dev/null 2>&1
#*/30 * * * * /home/vhserver/vhserver update > /dev/null 2>&1
#0 0 * * 0 /home/vhserver/vhserver update-lgsm > /dev/null 2>&1The first option launches the server after boot. The next three are supposed to keep the server alive and regularly update it, but they made my server unstable, so I commented them out.
8. Mod Management (for details see the original)
-
Manage mods:
./vhserver-mods
-
You must run the server at least once with the new mod to show up its config in:
~/serverfiles/BepInEx/config- Apply mod changes and create new mod configs with:
./vhserver restart
-
Export client modpack with
7: Export/Package Mods:- The pack location is in
Valheim-Mod-Manager/exports/. - There are many archives, but I recommend copy content of the newest
*-configs.zipto client's game folder to have a maximum sync. - If you are on client Linux Steam, set Valheim launch options:
./start_game_bepinex.sh %command%and do not forget make the sh script executable (+x)!
- The pack location is in
- Save directory (you can copy existing world's flw+db here, just change the name in STEP 5):
~/.config/unity3d/IronGate/Valheim/worlds_local/ - Backup the whole server (archive):
./vhserver backup
Add you SteamID to the
nano ~/.config/unity3d/IronGate/Valheim/adminlist.txtThis is great with the Server_devcommands mod, which allows you to use admin console in the game. You must add -console to the end you your game launch options to activate in-game console (~). Enter devcommands to access the admin mode.
Forward UDP 2456–2457 (always defined port and port+1) to your container IP.
./vhserver # Show commands
./vhserver details # Server info
./vhserver debug # Verbose run
./vhserver validate # Validate Steam files
tail -f log/console/vhserver-console.log # Live log-
Mods not loading (
isModded: Falseduring./vhserver debug)(STEP 5) Ensure line
executable="./start_server_bepinex_local.sh"is inlgsm/config-lgsm/vhserver/vhserver.cfg(STEP 4) Ensure file
serverfiles/start_server_bepinex_local.shhasexec ./valheim_server.x86_64 "$@" -
Wrong world loads, wrong password
Do the above (STEP 5) and (STEP 4) and check the name in the file too:
worldname="MyNeatWorld"
-
Server not listed / can’t join
(STEP 10) Check UDP ports 2456–2457 forwarding and firewall rules. Also wait like ~5 mins after the first start to let the server generate all necessary stuff.
-
Client not launching after I extracted the modpack archive in Linux
(STEP 8) Confirm the
start_game_bepinex.shin client game folder is executable (+x). -
Server disconnects after a while, unstable
(STEP 7) remove or comment out all except the
@rebootline from cron.
Everything as a root.
-
Create the service:
nano /etc/systemd/system/valheim-mods.service
[Unit] Description=Simple HTTP server for Valheim mods After=network.target [Service] WorkingDirectory=/home/vhserver/Valheim-Mod-Manager/exports ExecStart=/usr/bin/python3 -m http.server 8080 Restart=always User=vhserver [Install] WantedBy=multi-user.target -
Load the service:
systemctl daemon-reload systemctl enable --now valheim-mods.service -
Allow firewall if needed:
ufw allow 8080/tcp
-
The server is accessible at
http://<server_ip>:8080. I advise to download the newest*-configs.zipevery time.
Follow the same instructions, just:
-
Create different user e.g.
adduser vhserver2 -
STEP 3 before running the script you must change gamedir in
nano Valheim-Mod-Manager/config.ymlto the new user e.g.
gamedir: '/home/vhserver2/serverfiles/' -
STEP 5 define different port. Remember, the server always uses two: port and port+1, so if the first server was
port="2456"(2457), this one must be e.g.port="2458"(2459) -
STEP 7 change the path to the new user
-
STEP 11 include new ports in the firewall
-
STEP 14 pay attention to
WorkingDirectory -
If you copy something e.g. BepInEx plugins from different server, do not forget to set the owner, e.g.
chown -R vhserver2:vhserver2 /home/vhserver2/serverfiles
Changelog to the original Valheim Mod Manager
-
ready to use
config.yml, no changes needed for LGSM, unless you make multiple-instances server. -
added configs export function to have mod configs in sync with the client (the server config does not always prevails).