Create a server - LunaMultiplayer/LunaMultiplayer GitHub Wiki

Prerequisites

LMP version >= 0.28 (KSP >= 1.12)

Download net runtime

Windows

  • You need .NET Runtime 5 installed. Get the x64 version (unless you're running a 32 bit OS) here. Any other version (.NET 6, .NET 7) will not work.

Linux

  • You need .NET 5 installed. Get it here. If you're using a Raspberry Pi, you need to download the Arm32 binaries from here and follow these install instructions.

macOS

  • Only Macs with x64 / Intel CPU are supported by .NET 5. For Apple Silicon devices use the nightly builds based on .NET 6.
  • You need .NET 5 installed. Get it here.

If you are having troubles installing .NET 5 because it is out of support, try the nightly builds. They are based on .NET 6, and come with the runtime bundled. See below for instructions.

LMP versions < 0.28 (KSP < 1.12)

Windows

  • You need the .NET Framework 4.8 installed. It might come pre-installed with your Windows installation depending on the version.

Linux

  • You need the latest mono version. You can get it following the manual here

LMP nightlies >= 0.29.0.600

  • There are separate builds for Windows x64 (PC), Linux x64 (PC), Linux arm64 (Raspberry Pi with 64-bit OS) and Linux arm32 (Raspberry Pi with 32-bit OS, default Raspberry Pi OS / Raspbian).
    Choose the zip matching your operating system and architecture (Windows: win-x64, Linux: linux-x64, Raspberry Pi: linux-arm32 or linux-arm64)
  • These builds are completely self-contained, you don't need to install .NET.
  • If you are on a different system (e.g. macOS, Windows arm64), there is a framework-dependent built called any.
    For this one you will also have to install .NET 6, and run the server using dotnet Server.dll from a terminal.

Instructions:

  1. Before creating a server you must have a clear knowledge of what is a LAN, external IP, internal IP and what opening a port does.
  2. Download the LunaMultiplayer-Server-Release.zip asset of the latest release or the nightly version and extract it.
  3. Put the folder 'LMPServer' somewhere you like (but not inside the GameData folder of KSP!)
  4. Start the server:
  • Windows: Start the Server.exe. If it doesn't start: You are missing .NET 5.
  • Linux/Raspberry Pi LMP version >= 0.29.0.600 (nightly, KSP >= 1.12): Start the server with the command ./Server
  • Linux/Raspberry Pi LMP version >= 0.28 (KSP >= 1.12): Start the server with the command dotnet Server.dll
  • Linux/Raspberry Pi LMP versions < 0.28 (KSP < 1.12): Start the server with the command mono Server.exe
  1. Stop the server:
  • Windows: Stop the server by pressing CTRL + C or closing the server console window.
  • Linux/Raspberry Pi: Stop the server by pressing CTRL + C.
  1. You can now change the server configuration (Config/*.xml files) and start again.
  • Be sure to know how to correctly edit an XML!
    Example:
    This is an empty node: <AdminPassword />
    This is also an empty node (same meaning): <AdminPassword></AdminPassword>
    To add a value you need to add it between the two tags, e.g.: <AdminPassword>MYPASSWORD</AdminPassword>
  1. To connect you need the LMPClient installed. Follow the installation instructions here.
  • If you host the server on the same PC that your KSP is running on,use your local IP address: 127.0.0.1
  • If you are in a LAN game, the other clients must connect to your machine using your LAN IP (usually something like 192.168.---.---)
  • The other clients can connect through the server browser (no need to open ports manually, usually).
    This is preferred over connecting manually with the public IP address + port, because only with the server browser LMP does NAT+firewall punchthrough.

Important notes:

Network:

  • If you use Hamachi, proxies, VPN or something similar, you're on your own. LMP does not support them
  • Port 8800 is the default UDP port on LMP but it can be changed in one of the settings files.
  • You don't need to open ports unless you want that the clients connect to your server manually (entering the IP, not using the server browser) and without the use of the master server.
  • If you set up port forwarding, make sure that the port protocol is UDP.
  • Check that your (PC & router) firewall does not block the traffic on that port as well.
  • LMP >= 0.29 supports IPv6. With IPv6, even clients behind symmetric NAT or CGNAT can connect to your server. If you have connection problems, try enabling IPv6 for your server. To make your server accept IPv6 connections, change the ListenAddress option in ConnectionSettings.xml to [::].
  • Check that neither your router nor your computer block ICMP packets (ping requests) as otherwise you will appear with an infinite ping (∞) in the server browser.
  • If you do bad stuff your IP might get banned so behave decently. You can check the ban list here

Mods:

  • Check this page to see how to make mods/parts and expansions mandatory or forbidden

General:

  • Settings are stored in the xml files located in the Config folder. There you can set up a password to make your server private, change the game mode (Career/Sandbox/Science), difficulty, etc
  • If you set "Easy" as difficulty you won't see Kerbnet. Check custom difficulty page to see how to set a custom difficulty
  • Do not put the LMPServer folder inside the GameData folder of KSP.
  • Press Control+C when you want to close the server so a backup is made before exiting
  • Backup the Universe folder in case you want to keep your saved game somewhere safe
  • Remove the Universe folder to start a new game from scratch
  • If you want to flag your server as dedicated and have a custom color or the rainbow effect in the browser check this wiki page
  • Do not put flags manually in the Universe/Flags folder! The server will correctly put them once a player use one in his vessel

Docker

Pre-built images:

There are Docker images available here.
The master tag corresponds to the nightly builds, there are no release builds yet. As of 2022-07-11, the nightly builds are compatible with the 0.29 release.

Run docker pull ghcr.io/lunamultiplayer/lunamultiplayer/server:master to pull the image to your system.

Build your own images:

Simple:

Create a Dockerfile (for example in /opt/LunaMultiplayer) with the following content:

FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine

ARG LMP_VERSION=0.29.0
ARG LMP_FILENAME=LunaMultiplayer-Server-Debug.zip

ARG LMP_URL=https://github.com/LunaMultiplayer/LunaMultiplayer/releases/download/$LMP_VERSION/$LMP_FILENAME

RUN apk add icu-libs libstdc++ libgcc wget

RUN wget $LMP_URL && \
    unzip $LMP_FILENAME && \
    rm -rf $LMP_FILENAME LMP\ Readme.txt

EXPOSE 8800/udp 8900/tcp
VOLUME "/LMPServer/Config" "/LMPServer/Plugins" "/LMPServer/Universe" "/LMPServer/logs"
STOPSIGNAL sigint
WORKDIR /LMPServer
CMD ["dotnet", "Server.dll"]

Then build the image with

docker build -t lmpsrv:latest .

You can change the server version by adding --build-arg LMP_VERSION=versionNumber to the build command, where versionNumber is a release tag from Releases.

Advanced (build from source)

If you want to build the server from source inside the Dockerfile, clone the repository and build an image using Dockerfile_Server.


Usage

To run the LunaMultiplayer Server as a container with persistent data in /opt/LunaMultiplayer, create the directories:

mkdir -p /opt/LunaMultiplayer/{Config,Universe,Plugins,logs} && cd /opt/LunaMultiplayer/

Create the container and start it:

docker create \
  --name=lmpsrv \
  -it \
  -e TZ=CET \
  -p 8800:8800/udp \
  -p 8900:8900 \
  -v /opt/LunaMultiplayer/Config:/LMPServer/Config \
  -v /opt/LunaMultiplayer/Universe:/LMPServer/Universe \
  -v /opt/LunaMultiplayer/Plugins:/LMPServer/Plugins \
  -v /opt/LunaMultiplayer/logs:/LMPServer/logs \
  --restart unless-stopped ghcr.io/lunamultiplayer/lunamultiplayer/server:master

docker start lmpsrv

Replace ghcr.io/lunamultiplayer/lunamultiplayer/server:master with lmpserv:latest if you've built the image yourself instead of using the pre-built ones.

Now you can start and stop the server with docker start lmpsrv / docker stop lmpsrv. If your Docker service is starting on boot, so is your LMP server (if not manually stopped).

You can use the server console with docker attach lmpsrv, enter /help to see a list of commands. Detach from it using CTRL-P CTRL-Q.

If you already had a server running elsewhere and want to migrate to container, just copy the Config, Universe and Plugins directories to /opt/LunaMultiplayer and start the container.