--- title: "How to Manage Game Servers with LinuxGSM on Ubuntu 24.04" description: "Install LinuxGSM on Ubuntu 24.04, deploy a Valheim dedicated server, and automate monitoring, updates, backups and Discord alerts with built-in commands." category: "Game Servers" language: en source: https://cubepath.com/docs/game-servers/linuxgsm-for-game-server-management updated: 2026-09-25 --- # How to Manage Game Servers with LinuxGSM on Ubuntu 24.04 LinuxGSM (Linux Game Server Manager) is a command-line tool that installs and manages more than 100 dedicated game servers, including Valheim, Counter-Strike 2, Rust, Minecraft and 7 Days to Die. Every server gets the same set of commands for starting, stopping, updating, backing up and monitoring it, so once you know one, you know them all. In this tutorial you will install LinuxGSM on Ubuntu 24.04, deploy a Valheim dedicated server as an example, configure it, and automate crash recovery, updates, backups and Discord alerts. The same steps apply to any other game LinuxGSM supports; only the server name changes. ## Prerequisites To follow this tutorial, you will need: - A server running Ubuntu 24.04, for example a CubePath VPS. Valheim needs at least 2 vCPUs and 4 GB of RAM; check the requirements of your game, since some (ARK, Rust) need 8 GB or more. - At least 20 GB of free disk space for the game files and backups. - A non-root user with `sudo` privileges and UFW enabled. - Optional: a Discord server where you can create a webhook for alerts. ## Step 1 - Creating a dedicated user LinuxGSM refuses to run as root, and each game server should run under its own unprivileged user. That user does not need `sudo`: you will install system packages with your admin account. Create a user named after the server, which is the LinuxGSM convention: ```bash sudo adduser --disabled-password --gecos "" vhserver ``` Because the account has no password, you switch to it from your admin user with `sudo`: ```bash sudo -iu vhserver whoami ``` ```output vhserver ``` Type `exit` to return to your admin user for the next step. ## Step 2 - Installing dependencies Most game servers are downloaded with SteamCMD and include 32-bit binaries, so you need the i386 architecture and the `multiverse` repository, where Ubuntu ships SteamCMD: ```bash sudo dpkg --add-architecture i386 sudo add-apt-repository -y multiverse sudo apt update ``` Install the packages LinuxGSM and Valheim use: ```bash sudo apt install -y curl wget file tar bzip2 gzip unzip zstd bsdmainutils python3 util-linux ca-certificates binutils bc jq tmux netcat-openbsd lib32gcc-s1 lib32stdc++6 libsdl2-2.0-0:i386 libatomic1 libpulse-dev steamcmd ``` During the `steamcmd` installation you are asked to accept the Steam license. Use the arrow keys and Enter to accept it. > Note: Each game has slightly different dependencies. You don't need to guess them: when you run the installer in Step 4, LinuxGSM checks for missing packages and prints the exact `apt install` command to run. ## Step 3 - Downloading LinuxGSM Switch to the `vhserver` user and download the LinuxGSM bootstrap script into its home directory: ```bash sudo -iu vhserver curl -Lo linuxgsm.sh https://linuxgsm.sh chmod +x linuxgsm.sh ``` List the supported games to find the short name of the one you want: ```bash ./linuxgsm.sh list | grep -i valheim ``` The output shows the script name (`vhserver`) next to the game name. Other common names are `cs2server` (Counter-Strike 2), `rustserver` (Rust), `mcserver` (Minecraft Java) and `sdtdserver` (7 Days to Die). Create the Valheim management script: ```bash ./linuxgsm.sh vhserver ``` This creates an executable called `vhserver` in the home directory. From now on, every action on this server goes through it. ## Step 4 - Installing the game server Run the installer. It checks dependencies, downloads the server files through SteamCMD and creates the configuration files: ```bash ./vhserver install ``` The installer asks a few yes/no questions; the defaults are fine. The download takes a few minutes depending on the game size. When it finishes, the files are laid out like this: | Path | Contents | |------|----------| | `~/serverfiles/` | Game server files downloaded by SteamCMD | | `~/lgsm/config-lgsm/vhserver/` | LinuxGSM configuration for this server | | `~/log/` | Console and script logs | | `~/lgsm/backup/` | Backups created by the `backup` command | ## Step 5 - Configuring the server LinuxGSM keeps its settings in three files inside `~/lgsm/config-lgsm/vhserver/`: - `_default.cfg` contains every available setting with its default value. Do not edit it: it is overwritten on updates. - `common.cfg` applies to all instances of this game on the account. - `vhserver.cfg` applies only to this instance. This is where your changes go. Look up the setting names Valheim uses: ```bash grep -E '^(servername|serverpassword|port|public)=' ~/lgsm/config-lgsm/vhserver/_default.cfg ``` The output shows each setting with its default value. Open the instance configuration: ```bash nano ~/lgsm/config-lgsm/vhserver/vhserver.cfg ``` Add the settings you want to override, using your own values: ```bash servername="Your Server Name" serverpassword="your_server_password" port="2456" public="1" ``` Valheim requires a password of at least 5 characters, and the password must not appear in the server name. Settings you leave out keep the value from `_default.cfg`. Before starting the server, exit back to your admin user and open the game ports. Valheim uses UDP 2456 and 2457: ```bash exit sudo ufw allow 2456:2457/udp sudo ufw status ``` ## Step 6 - Starting and checking the server Switch back to the game server user and start it: ```bash sudo -iu vhserver ./vhserver start ``` LinuxGSM runs the server inside a `tmux` session, so it keeps running after you log out. Check the state, ports and configuration with: ```bash ./vhserver details ``` The output includes the server name, the password, the ports in use and a status line that should read `STARTED`. Valheim takes a minute or two to generate the world on first start. To watch the live console, use: ```bash ./vhserver console ``` To leave the console without stopping the server, press `Ctrl+b` and then `d`. Pressing `Ctrl+c` inside the console stops the server. Once the server has finished loading, join it from the game using `your_server_ip:2456` and the password you set. ## Step 7 - Learning the everyday commands All LinuxGSM scripts share the same commands. Each has a short alias: | Command | Alias | What it does | |---------|-------|--------------| | `start` | `st` | Start the server | | `stop` | `sp` | Stop the server | | `restart` | `r` | Restart the server | | `details` | `dt` | Show configuration, ports and status | | `console` | `c` | Attach to the live console | | `monitor` | `m` | Check the server and restart it if it has crashed | | `update` | `u` | Update the game server if a new build exists | | `check-update` | `cu` | Only check whether an update is available | | `validate` | `v` | Verify and repair game files with SteamCMD | | `backup` | `b` | Create a compressed backup | | `update-lgsm` | `ul` | Update LinuxGSM itself | | `test-alert` | `ta` | Send a test alert | | `debug` | `d` | Run the server in the foreground to see startup errors | Run `./vhserver` without arguments to see the full list for your game. ## Step 8 - Automating monitoring, updates and backups LinuxGSM does not run anything in the background by itself. You schedule its commands with cron under the game server user. Open that user's crontab: ```bash crontab -e ``` Add the following lines: ```text # Restart the server if it has crashed */5 * * * * /home/vhserver/vhserver monitor > /dev/null 2>&1 # Check for game updates and apply them (restarts the server only if needed) */30 * * * * /home/vhserver/vhserver update > /dev/null 2>&1 # Update LinuxGSM once a week 0 0 * * 0 /home/vhserver/vhserver update-lgsm > /dev/null 2>&1 # Daily backup at 05:00 0 5 * * * /home/vhserver/vhserver backup > /dev/null 2>&1 # Start the server after a reboot @reboot /home/vhserver/vhserver start > /dev/null 2>&1 ``` Confirm the jobs are installed: ```bash crontab -l ``` With the default `stoponbackup="on"` setting, the `backup` command stops the server while it archives the files and starts it again afterwards, so schedule it at a quiet hour. You can control retention in `vhserver.cfg`: ```bash maxbackups="7" maxbackupdays="14" ``` Create a first backup manually to check that it works: ```bash ./vhserver backup ls -lh ~/lgsm/backup/ ``` To see what a backup contains before restoring it, list its files: ```bash tar -tf ~/lgsm/backup/backup_file_name | head ``` To restore, stop the server, extract the archive over the home directory with `tar -xf`, and start it again. > Tip: Backups stored on the same disk do not protect you from a disk failure. Copy `~/lgsm/backup/` to another server or to object storage with a tool such as `rclone` or `restic`. ## Step 9 - Configuring Discord alerts LinuxGSM can notify you when the monitor restarts a crashed server or when an update is applied. It supports several services; Discord is one of the simplest to set up. In Discord, open **Server Settings > Integrations > Webhooks**, create a webhook for the channel you want and copy its URL. Then add these lines to `vhserver.cfg`: ```bash discordalert="on" discordwebhook="https://discord.com/api/webhooks/your_webhook_id/your_webhook_token" ``` Send a test message: ```bash ./vhserver test-alert ``` A message from LinuxGSM should appear in the Discord channel within a few seconds. Other alert services (email, Telegram, Slack, Pushover and more) are listed with their settings in `_default.cfg`. ## Troubleshooting **The server does not start or stops immediately.** Run it in the foreground to see the error: ```bash ./vhserver debug ``` Press `Ctrl+c` to exit debug mode. Common causes are a missing dependency (install what LinuxGSM reports), a port already in use, or a password that is too short. **Players cannot find or join the server.** Check that the ports are open with `sudo ufw status` and that the server is listening with `sudo ss -ulnp | grep 2456`. If you run the server behind another firewall, open UDP 2456-2457 there too. **The server runs out of memory.** Check memory use with `free -h`. If the kernel killed the process, `sudo journalctl -k | grep -i "out of memory"` shows it. Move to a plan with more RAM or add swap. **Game files are corrupted after an interrupted update.** Stop the server and repair the files: ```bash ./vhserver stop ./vhserver validate ./vhserver start ``` ## Conclusion You now have a Valheim dedicated server managed by LinuxGSM on Ubuntu 24.04, running as an unprivileged user, restarted automatically if it crashes, kept up to date, backed up daily and reporting to Discord. To host another game, create a new user and repeat the process with its server name, for example `cs2server`. To run a second instance of the same game on one account, run `./linuxgsm.sh vhserver` again: LinuxGSM creates `vhserver-2` with its own configuration file, where you set a different port. Finally, copy the backups off the server so a disk failure does not take your worlds with it.