Steam for Linux

Steam for Linux

Not enough ratings
Headless In-Home Steam Stream Server on Linux - HOW TO
By Dr. Zee
A detailed HOW-TO guide on setting up a Headless In-Home streaming Steam Server on Arch Linux. It should be possible to do this on other Linux flavours as well if you can find the right packages to install - which is essentially the only Arch Linux specific part of this guide.
 
Rate  
Favorite
Favorited
Unfavorite
Background
I have been running a small home server for years. Initially it was only doing basic file sharing and other minor stuff to support my home network.

I primarily only use laptops as my "workstations" (with external dual screens and keyboard) as I do not like to have big machines sitting under or around my desk producing noise and heat. Both laptops and servers are running pure Linux - if I need Windows once in a while I crank up a Virtual one ...

The laptops are not powerful enough to effectively run most of the later games on Steam supporting Linux (Prison Architect, Kerbal Space, XCOM 2 - to just name a few). Being tired of that and seeing that In-Home Streaming appears mature now I though I take a stab at upgrading my server and make it an Headless In-Home Steam Stream server.

Note, that I am using Arch Linux - not that, pr. say, I dislike Ubuntu or the other flavours I just got tired of constant "release updating" and liked the idea of rolling updates in Arch Linux. So far I had remarkably few problems with that.

If you have a little experience with Linux and not afraid of the command line I suggest you give Arch Linux a stab.

Well back to the Headless In-Home Steam stream server .....
Pre-requisites and Hardware
The guide assumes that you have your basic server up and running already with, at minimum, the SSH daemon running and configured correctly for remote login.

Also assume that you know how to use the 'sudo' command to elevate the user you use for the install and configuration to root status. Basic command line editing in 'vi', 'nano' or any other editor you may be using is also required. You should also be familiar with the concept of mounting disks and other basic Linux operation.

Most standard hardware you can buy around works quiet well with Linux. Some however requires most recent kernel - which is another reason for using Arch Linux as it always uses the newest kernel.

It is important that the Kernel supports your Network Card and Graphic Card. In particular the Network Card needs to be able to run 1 Gbit (and obviously your entire home network must support this too) as the bandwidth required for the streaming is substantial.

If you use NVIDIA/ATI cards this also most likely only works with the original manufacturer drivers. If you want to use the open-source drivers you do so at your own risk.

For reference here the hardware I used:
  • Motherboard: Gigabyte GA-Z170X-UD5 (has two nice 1 Gbit Ethernet ports)
  • CPU: Intel Core I7 6700 8M Skylake (water cooled with a Corsair H60 Cooler)
  • Graphics: EVGA GTX 960 4GB
  • Memory: 16 GB (2x8 GB)
  • For Disks:
    • 1x120 GB SSD for the boot/home volume
    • 2x2 TB HDD in RAID1 for the file shares
    • 1x256 GB SSD disk to hold all the Games Data from Steam

The separate drive for steam game data is not strictly necessary - I just didn't want to fill up the boot/home volume or the file sharing disks with the Game Data so I elected to have one.
Setup
All the below commands etc. are completed through a SSH connection to the server unless specified explicitly.

Since I am writing this off notes I took while experimenting and making the set-up, there may be one or two things that 'got lost in translation'. If someone does this from scratch and find something I missed please let me know in the comments.

Lets get to it:
  1. SSH to the server in question

  2. Arch is using systemd - so assume that is what we have. We dont want the server to pr. default boot into X or start the Display Manager so we force the boot target to boot into the command line:
    sudo systemctl set-default -f multi-user.target

  3. Install some packages we need (hope I didn't forgot one let me know in the comments if):
    sudo pacman -S nvidia lib32-nvidia-libgl nvidia-libgl xf86-input-libinput xorg-server xorg-server-utils xorg-xinit linux-headers ttf-liberation lib32-alsa-plugins nvidia-settings lib32-curl pulseaudio pulseaudio-alsa pamixer xfwm4 xfce4-session xfdesktop
    • Nvidia packages are the Nvidia drivers
    • Xorg/xf86 packages for the base X-Server
    • PulseAudio we need to have audio available for Steam (otherwise the streaming will be without sound)
    • Header and TTF fornt packages are needed for Nvidia/Steam programs
    • The Steam Client is 32bit and needs some 32bit Libs to work properly - hence the lib32 packages
    • Some games require a proper window manager to work. I use XFWM/XFCE4 packages as they are the most lightweight ones and can limit what to install. Others should work too.

  4. Reboot to load the Nvidia Drivers properly into the Kernel (Think there is way to do this without - was just too lazy to find out. Rebooting was quicker.)

  5. SSH back into the server and open in a editor (I use 'vi' below - you may use something else)
    sudo vi /etc/X11/Xwrapper.config
    and either add the below line or enter it as the only line in the file:
    allowed_users=anybody
    This will allow X to be started from a SSH Shell

  6. Create a new user just for steam and steam games:
    sudo useradd -m -g users -G video,storage,power -s /bin/bash -d /mnt/games/steamuser steamuser
    Note that:
    • -G video,storage,power are a number of groups the user should to be a member of - this may be different if you are not using Arch Linux
    • /mnt/games/steamuser is where the users home directory is going to be. If you omit this the system will create the home directory in the default location, typically /home/. As mentioned earlier, I do this, to put the steam game data on a different disk that is mounted at /mnt/games
    Set the password for the user
    passwd steamuser

  7. Install steam
    sudo pacman -S steam

  8. For some of the initial configuration steps and to set-up the Steam Client (there is verification process) it is necessary temporarily to connect a monitor/keyboard and mouse to the server.

    Connect screen, keyboard and mouse and run:
    sudo nvidia-xconfig
    which will generate the xorg.conf file we need for the initial X Server run.

  9. Change to the user created earlier
    sudo su - steamuser

  10. We now create some basic files that help us making it easier to start steam on the headless machine in the future.

    First we create an auto-start entry that will automatically start the Steam Client when XFCE4 starts:
    mkdir .config/autostart vi .config/autostart/steamheadless.desktop
    and enter the following:
    [Desktop Entry] Version=1.0 Encoding=UTF-8 Name=Script Type=Application Exec=steam -login <steam account name> <steam account password> Icon= Terminal=false StartupNotify=false Hidden=false GenericName= GenericName[en_US]=
    Make the file read only by the steamuser to protect the steam account password in it.
    chmod 600 .config/autostart/steamheadless.desktop
    Create a a small shell script that start steam and all that is needed
    vi startsteam.sh
    And enter the following:
    #!/bin/bash pulseaudio --start pamixer -u pamixer --set-volume 90 startxfce4 > /dev/null killall -u steamuser gpg-agent
    Note that:
    • pulseaudio and pamixer are used to setup pulseaudio, sometimes pulseaudio sets the volume to 'mute' and you don't get any sound in the stream. So we make sure its turned up.
    • /dev/null is needed to suppress output from Steam. Otherwise your Steam username/password is shown in clear text in the console. If you however need to debug Steam you can remove it to see what error Steam shows.

    Make the file executable:
    chmod +x startsteam.sh

  11. Start Steam for the first time
    ./startsteam.sh

  12. You should now see the desktop and Steam lunch on the screen you attached directly to the server. The attached keyboard and mouse should also work.

    You now need to go through the Steam validation process, accept the license and login for the first time.

    When you done, exit Steam clicking Steam->Exit from the top menu.

  13. Launch the nvidia-settings program - on XFCE4 desktop you can do that by right clicking anywhere and selecting Applications->Other->NVIDIA X Server Settings from the menu. Then:
    • Under GPU 0 (assuming you only have one NVIDIA Graphics card installed) write down the connected display number (usually starts with DFP-x) e.g. DFP-1
    • Select the display and click Aquire EDID.
    • Select EDID File Format to ASCII and save the file in the home folder of the steamuser - name the file edid.txt
    • Exit nvidia-settings program

  14. Shutdown the Xwindows Session - easiest by pressing Ctrl-C in the SSH window from where it was launched. Then exit from the steamuser account (type exit).

  15. We now modify the xorg.conf file to allow the X Windows to start without screen attached in headless mode.
    sudo vi /etc/X11/xorg.conf
    Under Section "Device" insert:
    Option "ConnectedMonitor" "<display>" Option "CustomEDID" "<display>:<path>/edid.txt"
    Remember to replace <display> with the display number from previous steps. Also replace <path> with the full path of where the file edid.txt is.

    You can use the below EDID information for a monitor with 1920x1080 resolution if you can not generate you own one:
    00 ff ff ff ff ff ff 00 1e 6d 39 58 37 f4 05 00 0c 15 01 03 80 30 1b 78 ea 33 31 a3 54 51 9e 27 11 50 54 a5 4b 00 71 4f 81 80 81 8f b3 00 01 01 01 01 01 01 01 01 02 3a 80 18 71 38 2d 40 58 2c 45 00 dd 0c 11 00 00 1e 00 00 00 fd 00 38 4b 1e 53 0f 00 0a 20 20 20 20 20 20 00 00 00 fc 00 45 32 32 31 31 0a 20 20 20 20 20 20 20 00 00 00 ff 00 31 31 32 4e 44 56 57 42 47 31 39 39 0a 00 38

    If you don't want to run at full resolution (to reduce network demand for the streaming) you can use below to emulate a 1440x900 monitor:
    00 ff ff ff ff ff ff 00 30 ae 36 40 00 00 00 00 00 13 01 03 80 1e 13 78 ea e5 95 93 56 4f 90 28 28 50 54 00 00 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 8e 2c a0 5c 52 84 1e 30 30 20 36 00 2f be 10 00 00 19 8e 2c a0 fc 52 84 87 30 30 20 36 00 2f be 10 00 00 19 00 00 00 0f 00 95 0a 32 95 0a 28 16 09 00 4c a3 42 54 00 00 00 fe 00 4c 54 4e 31 34 31 42 54 30 39 30 30 31 00 f0

  16. You can now disconnect the monitor/keyboard/mouse from the server - they should no longer be needed

  17. The basic set-up is now done. You can exit the SSH session to the server.
Running the Steam on the server
To run the Steam client on the server and connect to it from the Steam client running on you laptop/desktop workstation use the following:
  1. Start the Steam Client on your laptop/desktop workstation and login
  2. SSH to the server
  3. Run the command that switches to the Steam user:
    sudo su - steamuser
  4. Launch X and the Steam Client
    ./startsteam.sh
  5. On your laptop/desktop workstation you should see a message notifying that the In-House Steam Stream server now is available
  6. Start playing :)
Note:
  • In the laptop/desktop workstation Stem Client you can under Steam->Settings->In-Home Streaming->Advanced Client Options play with the settings to improve performance if you have network issues or reduce the resolution - useful if you want to run the streamed games in a window on you laptop/desktop workstation instead of full screen.
  • To switch from full screen to windowed mode you can press Alt-Enter after the streaming starts.
  • If the Steam Client needs to download/install updates start-up on the server may take longer than usual - up a minute or more. If the Client on your laptop/desktop workstation updates then its a good indicator that the client on the server also needs updating and you should expect the start-up on the server to be delayed.

Thats it - hope this helps some one out there to get this up running too.

I have happily been playing XCOM 2 on a 4 year old Lenovo T420 laptop, with dual-screens and cabled Gbit network connection in windowed mode, for hours using this set-up, streaming at 1920x1080, without any problems. The game has been running at full detail level without any issue for hours.

By the way - XCOM 2 complains about the NVIDIA driver being Unsupported, this may be due to the fact that Arch Linux always uses the very latest driver and that the game does not recognize it correctly. It however works without any issue and the game works perfectly.

Happy playing!
< >
4 Comments
luziferius Aug 22 @ 11:07am 
A note about the EDID data used for the virtual monitor: You may want one that contains the native resolutions for each display used by a client (1080p60, 1080p50, 1366x768 etc…). That way the host can adjust the resolution and refresh rate to whatever the client requests without needing to scale the image.
norman Mar 26 @ 4:17am 
This is absolutely awesome, its a pitty there are so little Linux games.
Lets hope with the Vulkan API, increasing its popularity this will benefit linux games.
soundsofpolaris Jul 28, 2016 @ 9:18am 
Thanks for this, it's *exactly* what I was looking for. I'll report back when I have it setup.
:(){ :|: & };: // z3ntu May 14, 2016 @ 8:40am 
Interesting idea to do that :)