I have a headless box that will be used for CUDA computing. I installed Ubuntu server 16.04.1 but when I try to install the nVidia drivers via apt-get it also wants me to install X11 and other GUI components.

How can I just install the driver and CUDA libs without installing X11 and friends?

Ideally without downloading the run file directly from nVidia. I'd like to use debian packages if possible.


This worked for me (on Ubuntu 16.04):

# apt-get -y install nvidia-cuda-toolkit lightdm-

lightdm is the windows manager that nvidia-* installs. The dash at the end tells apt-get to uninstall the package but dependency resolution figures out not to install it in the first place. This still installed xserver-common (so you still get some X11 stuff) but it did not enable graphical booting. (Adding xserver-common- resulted in broken dependencies.)

PS. You're probably past this problem but this answer is for future internet generations.

  • Thank you. I can vouch that ligthdm- works, even when installing from the official deb. – rpmcruz May 25 '18 at 11:59
  • Does this work with the official CUDA repo developer.nvidia.com/cuda-downloads on Ubuntu 18.04LTS? – 林正浩 Mar 2 '19 at 21:54
  • Following up with that logic, then installing CUDA on a headless system on Ubuntu 18.04LTS could be accomplished via: apt-get install cuda gdm3-. This would be via the cuda repo for Ubuntu. Test and report back. – 林正浩 Jun 15 '19 at 20:47

sudo apt-get -s install --no-install-recommends nvidia-current seem to be rather sparse with the dependencies on my box, but it already has a full graphical environment.

What you could in theory do is:

  1. Let apt-get download the pkg without install: sudo apt-get -d install nvidia-current
  2. Pick up the desired deb from the cache: ls /var/cache/apt/archives/ | grep nvidia-
  3. Install using dpkg, ignoring relevant dependencies: dpkg -i --ignore-depends=package1,package2 package3.deb

Dependencies are of course there for a reason, if I where in your situation I'd just let apt do its thing. Some X11-software won't hurt you much unless you run it.


If running (say, Blender on a headless server, you don't need all those dependencies.

Download the CUDA drivers from as a runfile from: https://developer.nvidia.com/cuda-downloads

Run sudo sh cuda_8.0.44_linux.run (or newer version)

Download the NVIDIA drivers from http://www.nvidia.com/Download/index.aspx?lang=en-us

Run: sudo sh /backup/iso/NVIDIA-Linux-x86_64-367.44.run (or newer version)

Note: Every time you update to a newer kernel, you'll have to reload the driver for that kernel. So you may want to add the "-a" (accept license terms) flag after going through them once.

My setup:

  • headless Xubuntu 16.04
  • dual GeForce 970 cards
  • Blender 2.78


  • Many unneeded dependencies not installed this way:» apt-get -s install nvidia-current | grep newly 0 upgraded, 65 newly installed, 0 to remove and 0 not upgraded. – OpenPrivacy Oct 21 '16 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.