Linux Game Servers

A quick guide on installing various game servers on Debian. As I write more guides for installing different game servers, this page may be split up into multiple pages.

Create a user account

Before creating any game servers, we will need to first create a new user account to run the game servers as. We will also enable user lingering with loginctl, to ensure that the systemd services created will always remain running.

  1. Create a new user account
useradd -m -s /bin/bash games
  1. Enable user lingering for the games user
loginctl enable-linger games

Minecraft Server

  1. Install Java JRE Headless
apt install default-jre-headless
  1. Create a new directory for the Minecraft server
su games -
mkdir -p ~/games/minecraft
cd ~/games/minecraft
  1. Download latest Minecraft server .jar file from https://www.minecraft.net/en-us/download/server, and save it to the ~/games/minecraft directory.

  2. Make systemd service directory (as minecraft user) and make a new service file:

mkdir -p ~/.config/systemd/user
nano ~/.config/systemd/user/minecraft.service

Contents of file ~/.config/systemd/user/minecraft.service:

[Unit]
Description=Minecraft Server

[Service]
WorkingDirectory=%h/games/minecraft
ExecStart=java -Xms1G -Xmx2G -jar server.jar

[Install]
WantedBy=default.target
  1. Start and enable service
systemctl --user daemon-reload
systemctl --user start minecraft
systemctl --user enable minecraft
  1. Open port 25565/tcp in firewall to allow others to connect to the server
firewall-cmd --permanent --zone=public --add-port=25565/tcp 
  1. Launch Minecraft on your computer and connect to the server

BeamMP Server

  1. Install BeamMP dependencies and dtach
apt install liblua5.3-0 libssl3 curl dtach
  1. Create game server folder
mkdir -p ~/games/beammp
cd ~/games/beammp
  1. Download BeamMP from GitHub.

Note: At the time of writing, there is no Debian 12 binary. Instead, use the Ubuntu 22.04 binary which appears to work fine.

wget https://github.com/BeamMP/BeamMP-Server/releases/download/v3.1.1/BeamMP-Server-ubuntu-22.04 -O beammp-server

# make the binary executable
chmod +x beammp-server
  1. Configure BeamMP using the directions on the BeamMP Wiki.

  2. Create systemd service file at ~/.config/systemd/user/beammp.service. Contents are below.

[Unit]
Description=BeamMP Server

[Service]
Type=forking
Restart=on-failure
RestartSec=5
WorkingDirectory=%h/games/beammp/
ExecStart=dtach -n /tmp/beammp ./beammp-server

[Install]
WantedBy=default.target

Start and optionally enable service

systemctl --user daemon-reload
systemctl --user start beammp
systemctl --user enable beammp
  1. Open port UDP and TCP port 30814, the port the BeamMP server listens on
firewall-cmd --permanent --zone=public --add-port=30814/tcp --add-port=30814/udp

If you need to use the BeamMP server console, run the following command:

dtach -a /tmp/beammp

You can detach from BeamMP console by hitting Ctrl + \. If you accidentally kill the server, it will automatically restart in 5 seconds.