Ubuntu Gaming Guide
Introduction
Playing games on Ubuntu is not news. Some games on Steam were supported by Linux natively and Wine provides compatibility to Windows games. However, previously it has some restrictions for your OS environment. People often failed due to driver mismatch or missing of libraries, as you can see from the issues on the GitHub steam repository.
My gaming experience on Ubuntu 18.04 was not very successful neither. I was not able to turn on Steam, not even mentioning Windows games in Wine, with the drivers I installed for Deep Learning. Although I have tried many tricks, I was only able to play some Linux native games, such as MineTest, but not other games. To play my favorite games, such as World of Warcraft, CS:GO, and Dota 2, I would have to reboot my computer and switch to Windows 10.
Recently I found that I could start to play the games on Steam and the Windows games in Wine on Ubuntu with the latest official NVIDIA drivers. I also tried the way I configured my Ubuntu for both deep learning and gaming on several different PCs with different hardware configurations, and all of them worked pretty well. So I am very excited to write this blog post on how to configure Ubuntu for both deep learning and gaming. Now that I could do both development and gaming on Ubuntu, I feel I could hardly go back to Windows.
Protocols
In this protocol, I assume the OS is Ubuntu 18.04. The other Linux distributions might also work but I just did not test them.
NVIDIA CUDA and Driver Installation
Deep learning developers need to install both NVIDIA driver and CUDA. Usually we install the CUDA package directly from the official NVIDIA driver website, and that package would include the driver package as well. While installing CUDA and driver via this way makes future upgrades easy, it did not support gaming on Ubuntu in my case previously, at least for the driver series 418. Recently, I found upgrading to the latest driver series 430 supports my Ubuntu gaming demand without sacrificing the environment configuration for deep learning.
Here is how you will install the latest NVIDIA CUDA and driver. You go to https://developer.nvidia.com/cuda-downloads
, select your PC architecture, Linux distribution, and Version, and finally make sure to select deb (network)
for Installer Type. Then you will get the installation guide to install both the latest CUDA and driver.
Concretely, for Ubuntu 18.04, we run the following commands to install.
1 | $ wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.1.168-1_amd64.deb |
To verify the installation is successful. We run nvidia-smi
in the terminal.
1 | $ nvidia-smi |
In this case, we could see that the driver version is 430.26
and the CUDA version is 10.2
.
NVIDIA CUDA and Driver Upgrade
Once the NVIDIA CUDA and driver were installed via the way I described above, to upgrade in the future, we could simply run the following command.
1 | $ sudo apt-get update |
Steam Installation
Because Steam games use OpenGL as the graphics interface on Ubuntu and it seems that it only supports 32-bit OpenGL. Players with 64-bit systems have to install some weird i386
libraries, such as libgl1-mesa-dri:i386
and libgl1-mesa-glx:i386
etc. There is no such information officially from the Steam installation guide, and it is often very hard to troubleshoot what is missing for Steam for beginners.
Now we could install steam with apt
, and all the dependencies will also be installed automatically.
1 | $ sudo apt-get install steam |
To run Steam, simply run the following command in the terminal.
1 | $ steam |
Lutris Installation
Lutris supports a variety of Windows applications and games, including Blizzard games, using Wine. To install Lutris, please follow the instructions on the official website.
Concretely, for Ubuntu 18.04, we run the following commands to install.
1 | $ sudo add-apt-repository ppa:lutris-team/lutris |
To run Lutris, simply run the following command in the terminal.
1 | $ lutris |
Others
There are of course other platforms, such as GOG. But I am not going to cover all of them.
Games
I played several games with the highest graphics settings on my PC which has a ROG SWIFT PG27UQ 120Hz refresh rate 4K resolution monitor and an NVIDIA RTX 2080 TI GPU.
Dota 2 from Steam
World of Warcraft from Lutris
Updates
2/23/2020
Steam only uses 32bit NVIDIA drivers. Sometimes, the NVIDIA driver installed using the official methods described above would miss i386 drivers. If this happens, we have to either roll back to the last NVIDIA driver which comes with i386 packages and support Steam using the official methods or add ppa driver repository and use the latest driver supported which usually comes with i386 packages.
1 | sudo add-apt-repository ppa:graphics-drivers/ppa |
Make sure that the i386 packages are installed. Otherwise Steam would not run on Ubuntu. For some users who have conflicting added apt repositories, i386 packages would not be installed even though they are in the repository. To resolve this, remove the conflicting NVIDIA apt repositories from Ubuntu Software & Updates.
Final Remarks
Do remember to balance your work and game.
Ubuntu Gaming Guide