openOMSI GitHub Discord
Dedicated server

Docs / Multiplayer / Dedicated server

Running as a service

1 min readEdit this pagedocs/SERVER.md

On this page
  1. Linux (systemd)
  2. Windows
  3. Docker (Linux)

The start scripts start.sh and start.cmd are meant for services: they ask nothing.

Linux (systemd)#

  1. Create a user for the server, for example openomsi, and unpack the server into /opt/openomsi-server.
  2. Run it once by hand to write server.cfg, then edit it.
  3. Create /etc/systemd/system/openomsi-server.service:
INI
[Unit]
Description=openOMSI dedicated server
After=network-online.target
Wants=network-online.target

[Service]
User=openomsi
WorkingDirectory=/opt/openomsi-server
ExecStart=/opt/openomsi-server/start.sh /srv/omsi2 /opt/openomsi-server/server.cfg
Restart=on-failure
RestartSec=10
KillSignal=SIGINT
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target
  1. Start it and enable it at boot:
shell
sudo systemctl daemon-reload
sudo systemctl enable --now openomsi-server
journalctl -u openomsi-server -f

The players' buses and the owner's ban list live in the service user's ~/.openomsi.

Windows#

Use the Task Scheduler, which every Windows has:

  1. Open Task Scheduler → Create Task.
  2. General: a name, Run whether user is logged on or not.
  3. Triggers: At startup.
  4. Actions: Start a program, program C:\openomsi-server\start.cmd, arguments "C:\path\to\OMSI 2", start in C:\openomsi-server.
  5. Settings: untick Stop the task if it runs longer than. Optionally If the task fails, restart every 1 minute.

Docker (Linux)#

The repository has a container setup in docker/server (see its README.md):

shell
cd docker/server
cp .env.example .env              # set OMSI_DIR to your OMSI 2 folder
mkdir config
cp server.cfg.example config/server.cfg
docker compose up -d --build
docker compose logs -f

The OMSI 2 folder is mounted read-only. config/ holds server.cfg, content/ the packed maps, and a volume keeps the players' buses. The server is ready when http://<address>:27025/status answers (docker ps shows healthy). Docker keeps the log itself: five files of 20 MB.

Something wrong or missing? Fix it on GitHub or open an issue.

↑↓ to move↵ to open