Search
K
Links

How to set up a remote game-streaming server for Moonlight

Discover how to configure a remotely accessible game-streaming server on Windows, macOS, and Linux using Meshnet.
A game-streaming server allows you to start a game instance on a dedicated machine and play it from other client devices. Such configuration can help overcome operating system and hardware limitations and enjoy various games on devices that can’t run them natively.
Sunshine is an open-source solution that allows you to transform your device into a dedicated game server. It's easy to set up and doesn't require permanent changes to your system. Sunshine is designed to work as a host for the Moonlight game-streaming client.
While the app combination can be used hassle free on the local area network (LAN), the remote gaming option is available only by configuring port forwarding or complicated network setups. By supplementing the game-streaming setup with Meshnet, you can easily connect your remote devices to a single network and enjoy your games over a fast and encrypted network tunnel.
This guide showcases how you can turn your device into a VPN gaming server using Sunshine and play remotely using the Moonlight client.

Before you begin

Make sure that your server’s hardware and software fit the system requirements provided on the Sunshine documentation page.

Configure the Sunshine server

Start your setup process by configuring the Sunshine server.

Installing Sunshine

Begin by installing Sunshine on the machine that will function as your game server.
Windows
macOS
Linux
  1. 1.
    Visit the Releases page of the Sunshine GitHub repository.
  2. 2.
    Download the Windows installer file for the latest available version.
    Downloading the Sunshine windows installer file from GitHub.
  3. 3.
    Launch the downloaded file. If the Microsoft Defender SmartScreen window shows up, select More info and click Run anyway.
  4. 4.
    Follow the instructions presented by the installation wizard.
  5. 5.
    Click Finish to complete the process and close the installer window.
Note
Sunshine on macOS is still in its experimental stage. For this reason, some features may not be available.
  1. 1.
    Install the MacPorts open-source package manager.
  2. 2.
    Open Terminal.
  3. 3.
    Run the echo %HOME | xargs basename command to find the name of your home directory. Example
    Running the provided command in Terminal.
  4. 4.
    Append a new line to the MacPorts sources.conf file, where <name> is the output you received in step 3, by executing this command:
    echo 'file:///Users/<name>/ports' | sudo tee -a /opt/local/etc/macports/sources.conf
    You may be asked to enter your administrator password. The input will be hidden. Example
    Running the provided command in Terminal.
  5. 5.
    Visit the Releases page of the Sunshine GitHub repository and download the Portfile of the latest available version.
    Downloading the macOS Portfile from GitHub.
  6. 6.
    Ensure that the Portfile is located in your Downloads folder and run the following six commands to install Sunshine:
    export PATH=$PATH:/opt/local/bin
    mkdir -p ~/ports/multimedia/sunshine
    mv ~/Downloads/Portfile ~/ports/multimedia/sunshine/
    cd ~/ports
    portindex
    sudo port install sunshine -y
Note
In this article, the Ubuntu 22.04.1 LTS Linux distribution is used as an example.
  1. 1.
    Visit the Releases page of the Sunshine GitHub repository.
  2. 2.
    Download the latest package for your Linux distribution and system architecture.
    Downloading the Sunshine package for Ubuntu 22.04 from GitHub.
  3. 3.
    Open Terminal and navigate to the downloaded file’s location using the cd command. Example
    cd ~/Downloads
  4. 4.
    Install the Sunshine package and its required dependencies by running the following command:
    sudo apt install -f ./sunshine* -y
  5. 5.
    Check whether Sunshine is installed properly with this command:
    sunshine --version
    Terminal output showing the version of Sunshine.
Tip
If you install Ubuntu .deb package, you may receive the following error message when trying to interact with Sunshine:
sunshine: error while loading shared libraries: libboost_chrono.so.1.74.0: cannot open shared object file: No such file or directory
To resolve this problem, install the libboost-chrono1.74.0 package with this command:
sudo apt install libboost-chrono1.74.0

Starting Sunshine

After installing Sunshine, you need to initialize the server app and access its web user interface (UI), where all of the settings are located.
Windows
macOS
Linux
  1. 1.
    Launch Sunshine. It will open the https://localhost:47990/ URL in your default internet browser.
  2. 2.
    Enter your preferred Sunshine username and password and click Login.
    Entering username and password in the Sunshine web UI.
  3. 3.
    Once the page reloads, log in using your newly created account credentials.
Note
You may see a “Your connection is not private” message because Sunshine is using a self-signed SSL certificate. To proceed further, click Advanced > Proceed to localhost (unsafe).
  1. 1.
    Open Terminal.
  2. 2.
    Run the sunshine command to initialize Sunshine. During the process, you will be asked to grant system permissions — make sure to allow them. Once Sunshine is ready, you should see this output in your command line window:
    Info: Configuration UI available at [https://localhost:47990]
  3. 3.
    Open your internet browser and visit the following URL: https://localhost:47990/
  4. 4.
    Enter your preferred Sunshine username and password and click Login.
    Entering username and password in the Sunshine web UI.
  5. 5.
    Once the page reloads, log in using your newly created account credentials.
Note
You may see a “Your connection is not private” message because Sunshine is using a self-signed SSL certificate. To proceed further, click Show details > visit this website.
  1. 1.
    Open Terminal.
  2. 2.
    Run the sunshine command to initialize Sunshine. Once Sunshine is ready, you should see this output in your command line window:
    Info: Configuration UI available at [https://localhost:47990]
  3. 3.
    Open your internet browser and visit the following URL: https://localhost:47990/
  4. 4.
    Enter your preferred Sunshine username and password and click Login.
    Entering username and password in the Sunshine web UI.
  5. 5.
    Once the page reloads, log in using your newly created account credentials.
Note
You may see a “Your connection is not private” message because Sunshine is using a self-signed SSL certificate. To proceed further, click Advanced > Accept the risk and continue.

Importing games

Once you access the Sunshine web UI, you can start importing the games you want to play on other remote devices. Depending on the OS you use and the games you want to add, the steps may vary slightly. For this example, a game from Steam on Windows will be imported to the Sunshine library.
  1. 1.
    On the Sunshine web interface, select the Applications section.
  2. 2.
    Click Add new.
  3. 3.
    Fill in the following fields:
    • In the Application name field, type in the name of the game you want to import.
    • In the Command field, enter a command to initialize the game’s executable file.
      • For Windows: cmd /c <file_name.exe>
      • For macOS and Linux: <file_name>
    • In the Working directory field, enter the path of the game’s folder on your system. Example
      Filled in Application name, Command, and Working directory fields with the game's information on Sunshine web UI.
  4. 4.
    Click Save.
The game is now added to your Sunshine server library, and client devices will be able to remotely play it.
Note
You can find more detailed guidelines for adding games and apps to your server’s library on the Sunshine documentation page.

Set up the Moonlight client

Once the Sunshine server is running and you have added your desired games, you can install the Moonlight game-streaming client on all devices that will be connecting to the server.

Installing Moonlight

For devices running desktop operating systems, you can get the Moonlight client installer files from the “Downloads” section of the Moonlight PC GitHub repository.
For mobile devices, you can download the Moonlight client from the following GitHub repositories:

Pairing with the Sunshine server

To establish a connection between your Sunshine server and the Moonlight client, you need to pair the devices. While Moonlight automatically scans for servers in your LAN, you need to manually add your remote Meshnet server.
  1. 1.
    Open Moonlight.
  2. 2.
    In the upper-right corner, select the computer icon. Alternatively, you can press Ctrl + N on your keyboard.
    Clicking 'Add PC manually' in Moonlight.
  3. 3.
    In the new dialog, enter the Nord name of your Sunshine server and click OK.
    Entering the Nord name of the Sunshine server and clicking 'OK'.
  4. 4.
    Select the newly added device’s icon in the Moonlight window. Upon clicking the server’s icon, you will be shown a PIN code.
  5. 5.
    Open the Sunshine web interface and select PIN at the top.
  6. 6.
    Enter the PIN code prompted on your client device and click Send.
You should see a green success message indicating that pairing was successful.

Play games remotely over Meshnet

After successful pairing, you can start playing games from your server’s library on other devices remotely.
  1. 1.
    In Moonlight, select your Sunshine server.
    Selecting the newly added Sunshine server in Moonlight.
  2. 2.
    From the list of available games, select the one you want to play.
The game will shortly load, and you’ll be able to enjoy your remote gaming session!
Tip
You can use the Moonlight settings menu to change the streaming resolution and bitrate to optimize the game-streaming quality for your setup.
© 2023 Nord Security. All Rights Reserved.