How to build the Ultimate Game Streaming Server
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
This is a comprehensive guide on how to build the ultimate game streaming server. With a dedicated game streaming server all the processing and rendering is centralized and then streamed to any type of device.
Once complete you should be able to stream games to just about any device:
- Linux
- macOS
- Windows
- Raspberry Pi
- Steam Deck
- Steam Link
- Android
- iOS
- Amazon Fire tablets and TVs
- Apple TV
- ChromeOS
- PS Vita
- Xbox
- LG webOS TVs
I got the idea for this when I tried using Bazzite but ran into issues with Wayland on Nvidia and Fedora Atomic Desktops. Once I figured out the major components of what all was needed I decided I'd try to roll my own configuration on Ubuntu.
- A physical server or VM
- Dedicated GPU (AMD, Intel, or Nvidia)
- Monitor and/or DisplayPort/HDMI Emulator
- This will need to be plugged into your GPU and what you select here will determine the maximum resolution and refresh rate you can stream games at
- For example, if you only care about 1080p at 60hz just about every monitor will do that or you can buy a generic DisplayPort Emulator or HDMI Emulator
- If you want a high refresh rate for gaming, for example 1440p at 144hz or 1080p at 240hz, you will need a high refresh rate DisplayPort Emulator or high refresh rate monitor. Be sure to verify the emulator supports the resolution and refresh rate you want.
- Any device listed in the About section above that you can stream to
- Optional: Keyboard, Mouse, Xbox Controller
- Ubuntu 24.04 Desktop - Desktop OS
- Sunshine - Backend streaming service
- Moonlight - Host client to connect to Sunshine
All other additional software listed below is optional but I imagine most people would be using Steam at a minimum.
If you won't be building your server as a VM skip this section
- Proxmox VM Configuration (adjust accordingly)
- CPU: 16 Cores
- Type:
Host
- Type:
- Memory: 32 GB Memory
- Ballooning Device:
Disabled
- Ballooning Device:
- Storage
- Controller:
VirtIO SCSI single
- Disks:
- OS - 100GB
- Games - 1TB (Optional)
- Enable
SSD Emulation
,IO thread
, &Discard
- Controller:
- Graphics Card:
Standard VGA
- Set this to
None
after you attach your GPU, but we need a basic display out for the OS install
- Set this to
- BIOS:
OVMF (UEFI)
- Make sure you add an EFI disk
- Uncheck
Pre-enroll Keys
as this will enable Secure Boot by default which we don't need
- CPU: 16 Cores
- Add your Ubuntu ISO as media for the CDROM drive
- Boot to the ISO
- Select the
Default Installation
- Skip the third party drivers and additional media formats unless you know you need it. We will be installing GPU drivers manually later.
- Make sure the OS is installed to the 100GB drive
- Uncheck
Require my password to log in
- Remove CD/ISO once installation is complete and reboot
-
Install Additional Packages
sudo apt install -y build-essential curl dkms git openssh-server vim
-
Use X11 for Nvidia
- If you are using an Nvidia GPU you should use X11 rather than Wayland display server, if you are unsure of what you are currently running
echo $XDG_SESSION_TYPE
. To switch, logoff and click the gear in the bottom right and selectUbuntu on Xorg
.nvfbc
, NVIDIA Frame Buffer Capture allows you to capture direct to GPU memory, significantly improving performance. At the time of this writingnvfbc
does not work on Wayland.
- If you are using an Nvidia GPU you should use X11 rather than Wayland display server, if you are unsure of what you are currently running
-
Configure auto-login
- Your server must also auto-login without a password. This should have been configured in the OS installation but if not,
Settings => System => Users
and enableAutomatic Login
- Your server must also auto-login without a password. This should have been configured in the OS installation but if not,
-
Disable Screen Blanking
- Disable any type of screen saver, suspend, or screen blanking.
Settings => Power => Screen Blanking
toNever
- Disable any type of screen saver, suspend, or screen blanking.
-
Do Not Disturb Mode
- Enable Do Not Disturb in the notifications bar to disable any popups.
-
Enable SSH
sudo systemctl enable ssh
-
Install QEMU Agent (Optional) - Only if your streaming server is a Proxmox VM
sudo apt install -y qemu-guest-agent
If you configured a secondary drive to store games
- Run
lsblk
to find your secondary drive,/dev/sdb
for example - Format drive
(echo d; echo g; echo w) | sudo fdisk /dev/sdb sudo mkfs.ext4 /dev/sdb
- Mount drive
# Get the UUID of the drive lsblk -f # Create games mount point sudo mkdir /mnt/games # Append to /etc/fstab /dev/disk/by-uuid/<drive_uuid_here> /mnt/games ext4 noatime,nodiratime,nosuid,nodev,nofail,x-gvfs-show 0 0 # Appears that systemd is tied into fstab now sudo systemctl daemon-reload # Set perms on drive to local user (change your_userid) sudo chown -R your_userid:your_userid /mnt/games # Mount drive sudo mount -a # Verify drive is working df -hT
- Shutdown VM or host and install GPU if you haven't already
- Proxmox GPU Config
- Remove the Standard VGA virtual adapter
- Add PCI Device
- Raw Device, select your GPU device
- Enable
All Functions
- Enable
Primary GPU
- Enable
ROM-Bar
- Enable
PCI-Express
- Proxmox GPU Config
- Plug in monitor or DisplayPort/HDMI emulator to the GPU
- Boot host back up
Coming soon...
Coming soon...
- Grab the latest drivers for your GPU Nvidia 3060 - 565.77 latest at the time of writing this
wget https://us.download.nvidia.com/XFree86/Linux-x86_64/565.77/NVIDIA-Linux-x86_64-565.77.run
chmod +x NVIDIA-Linux-x86_64-565.77.run
sudo ./NVIDIA-Linux-x86_64-565.77.run
- Multiple kernel module types are available for this system. Which would you like to use?
MIT/GPL
- An alternate method of installing the NVIDIA driver was detected.
Continue installation
- The Nouveau kernel driver is currently in use by your system. This driver is incompatible with the NVIDIA driver, and must be disabled before proceeding.
-> Nouveau can usually be disabled by adding files to the modprobe configuration directories and rebuilding the initramfs.
OK
- Would you like nvidia-installer to attempt to create these modprobe configuration files for you?
Yes
- One or more modprobe configuration files to disable Nouveau have been written. You will need to reboot your system and possibly rebuild the initramfs before these changes can take effect. Note if you later wish to reenable Nouveau, you will need to delete these files: /usr/lib/modprobe.d/nvidia-installer-disable-nouveau.conf, /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
-> nvidia-installer is not able to perform some of the sanity checks which detect potential installation problems while Nouveau is loaded. Would you like to continue installation without these sanity checks, or abort installation, confirm that Nouveau has been properly disabled, and attempt installation again later?
Continue installation
- Install NVIDIA's 32-bit compatibility libraries?
Yes
- Would you like to rebuild the initramfs?
Yes
- Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X? Any pre-existing X configuration file will be backed up.
Yes
- Verify drivers are installed correctly:
nvidia-smi
- Reboot
- Download the Steam Debian package
wget https://cdn.fastly.steamstatic.com/client/installer/steam.deb
- Install Steam
sudo apt install -y -f ./steam.deb
- Launch Steam
steam
- Configure Steam to auto start on login
- Under Storage add /mnt/games mount point and set it as the default
- Under Compatibility enable
Enable Steam Play for all other titles
Lutris is an open gaming platform for Linux. Lutris helps you install and play video games from all eras and from most gaming systems.
Wine must be installed before you install Lutris
sudo dpkg --add-architecture i386
sudo mkdir -pm755 /etc/apt/keyrings
wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key -
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/noble/winehq-noble.sources
sudo apt update
sudo apt install --install-recommends wine-stable
- Download the Lutris Debian package
wget https://github.com/lutris/lutris/releases/download/v0.5.18/lutris_0.5.18_all.deb
- Install Lutris
sudo apt install -y -f ./lutris_0.5.18_all.deb
EmuDeck is a collection of scripts that allows you to autoconfigure your Steam Deck (works on Linux too), it creates your roms directory structure and downloads all of the needed Emulators for you along with the best configurations for each of them. EmuDeck works great with Steam Rom Manager or with EmulationStation DE.
- Download prereqs
sudo apt install -y bash flatpak git jq libfuse2 rsync unzip zenity
- Install EmuDeck
curl -L https://raw.githubusercontent.com/dragoonDorise/EmuDeck/main/install.sh | bash
- Walk through initial setup
- Copy BIOS
- Copy ROMs
- Add Emulation Station to Steam
- In Steam, go to
Games
menu Add a Non-Steam Game to My Library...
- Select
ES-DE AppImage
- Rename the application in Steam to
EmulationStation DE
- In Steam, go to
Sunshine Self-hosted game stream host for Moonlight.
- Grab the latest version of Sunshine v2024.1227.43619
wget https://github.com/LizardByte/Sunshine/releases/download/v2024.1227.43619/sunshine-ubuntu-24.04-amd64.deb
- Install Sunshine
sudo apt install -y -f ./sunshine-ubuntu-24.04-amd64.deb
- Create and reload udev rules for uinput to create mouse and gamepad events:
echo 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG="uaccess"' | \ sudo tee /etc/udev/rules.d/60-sunshine.rules sudo udevadm control --reload-rules sudo udevadm trigger sudo modprobe uinput
- Configure autostart service
# ~/.config/systemd/user/sunshine.service [Unit] Description=Sunshine self-hosted game stream host for Moonlight. StartLimitIntervalSec=500 StartLimitBurst=5 [Service] ExecStart=/usr/bin/sunshine Restart=on-failure RestartSec=5s [Install] WantedBy=graphical-session.target
- Enable autostart
systemctl --user enable sunshine
reboot
The default configs will work for most people but adjust as necessary
- Sunshine is configured at
https://localhost:47990
- Sunshine Official Documentation
Sunshine Applications are configurations that get applied based on how you want to connect to the Sunshine server. For example you can create an application that configures 720p at 60hz and then launches Steam in Big Picture mode, this would be the ideal setup for a Steam Deck. Another example might be an application that configures 1440p at 144hz and launches Steam in normal mode for a more traditional gaming setup.
Here are my applications I have setup.
- Desktop - This is a "dynamic" in that it will apply the same resolution and refresh rate that the client connecting is using.
- Do Command
sh -c "xrandr --output DP-2 --mode \"${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}\" --rate ${SUNSHINE_CLIENT_FPS} --output DP-1 --off"
- Undo Command
xrandr --output DP-1 --mode 1920x1080 --rate 60 --output DP-2 --off
- Do Command
- MoonDeckStream - This is configured to match the Steam Deck resolution and refresh rate.
- Do Command
xrandr --output DP-2 --mode 1280x800 --rate 60 --output DP-1 --off
- Undo Command
xrandr --output DP-1 --mode 1920x1080 --rate 60 --output DP-2 --off
- Command
/home/sam/MoonDeck/MoonDeckBuddy.AppImage --exec MoonDeckStream
- Do Command
- Steam Big Picture - Similar to Desktop but launches Steam in Big Picture Mode
- Do Command
sh -c "xrandr --output DP-2 --mode \"${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}\" --rate ${SUNSHINE_CLIENT_FPS} --output DP-1 --off"
- Undo Command
xrandr --output DP-1 --mode 1920x1080 --rate 60 --output DP-2 --off
- Detached Commands
setsid steam steam://open/bigpicture
- Do Command
My setup will differ from yours but run xrandr
(Assuming you are using X11 as xrandr does not work with Wayland) to get an idea of what displays you have and what resolutions they support. In my case, DP-1 is DisplayPort 1 which is a 1080p 60hz physical monitor, and DP-2 is DisplayPort 2 which is a high refresh rate DisplayPort Emulator.
Moonlight GameStream client for PCs (Windows, Mac, Linux, and Steam Link)
MoonDeck is a plugin that makes it easier to manage your gamestream sessions from the Steam Deck and integrates with Sunshine. If you are wanting to stream games to your Steam Deck I highly recommend using this plugin.
There are two components:
- MoonDeck plugin which you install through Ducky on your Steam Deck
- MoonDeck Buddy which you install on your streaming server and integrates with Sunshine. Install Instructions
xone is a Linux kernel driver for Xbox One and Xbox Series X|S accessories. Useful if you have an Xbox controller you want to hook up locally to your streaming server.
mkdir ~/git
cd git
git clone https://github.com/medusalix/xone
sudo ./install.sh
sudo xone-get-firmware.sh --skip-disclaimer
A collection of awesome Sunshine scripts, tools, guides and companion software.
My experience with Steam Remote Play is it has lower quality with lag issues, assuming you can launch the game.
More of a commercial application that has a free and paid tier, in my limited testing it works connecting from a Linux client to a Windows PC with good performance.
- Ansible Script
- Salt State
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Project Link: https://github.com/tuxthepenguin84/ugss