Skip to content

Instantly share code, notes, and snippets.

@rejunity
Last active October 1, 2021 11:30
Show Gist options
  • Save rejunity/61a20a04205186793339c6538a9624d6 to your computer and use it in GitHub Desktop.
Save rejunity/61a20a04205186793339c6538a9624d6 to your computer and use it in GitHub Desktop.
How to run Unity standalone on Amazon AWS Cloud
# Recipe on running Unity (or any OpenGL based application) on Amazon Cloud EC2
# Requirement: Instance with GPU (g2 or p2) and Ubuntu14.04
# Tested on g2.2xlarge with Ubuntu14.04.
# Summary: install NVIDIA driver, configure virtual display, patch configuration, run X server and your application
# Also see: https://askubuntu.com/questions/429596/how-to-choose-the-vga-when-setting-up-the-x-server/534622#534622
# prerequisites
sudo apt-get update
sudo apt-get install -y gcc make linux-generic
# install X server and OpenGL tools
sudo apt-get install -y xserver-xorg mesa-utils
# disable Nouveau
sudo echo 'blacklist nouveau' | sudo tee -a /etc/modprobe.d/blacklist.conf
sudo echo 'options nouveau modeset=0' | sudo tee -a /etc/modprobe.d/blacklist.conf
sudo echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
sudo reboot now
# install NVIDIA drivers
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/340.46/NVIDIA-Linux-x86_64-340.46.run
sudo /bin/bash ./NVIDIA-Linux-x86_64-340.46.run --accept-license --no-questions --ui=none
sudo reboot now
# configure virtual display device for X server - it should writes into xorg.conf file
sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
# add missing BusID
sudo sed -i 's/ BoardName "GRID K520"/ BoardName "GRID K520"\n BusID "0:3:0"/g' /etc/X11/xorg.conf
# run X server and Unity standalone application
sudo /usr/bin/X :0 &
DISPLAY=:0 $your_unity_exec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment