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.


4 Answers 4


This worked for me (on Ubuntu 16.04):

sudo apt-get 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. May 25, 2018 at 11:59
  • Does this work with the official CUDA repo developer.nvidia.com/cuda-downloads on Ubuntu 18.04LTS? Mar 2, 2019 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, 2019 at 20:47
  • Skipping the nvidia-settings graphical nVidia tool cuts things down a lot for me (on 19.10). I'd like to also skip the xserver-xorg-video-nvidia-* package, but that's a hard requirement for the driver, which pulls in the X server junk. So, sudo apt install nvidia-driver-435 nvidia-settings- is about the best bet, IMO. Add nvidia-cuda-toolkit onto that package list to get the useful cuda parts.
    – dannysauer
    Mar 9, 2020 at 6:41
  • I've never seen the - suffix before. +1 for teaching me something I didn't know I was missing!
    – Joe
    Nov 17 at 8:55

The way to do this on recent versions of Ubuntu:

sudo apt install --no-install-recommends nvidia-cuda-toolkit nvidia-headless-440 nvidia-utils-440

This won't install any X11 packages at all. Replace 440 with the driver version you want. nvidia-utils gives you nvidia-smi which is a CLI tool to show GPU utilization and temperature and other such information.

If nvidia-smi returns an error, check /lib/modprobe.d/blacklist-nvidia.conf and comment out the line alias nvidia off. Then you can enable the driver with sudo modprobe nvidia.

  • More up-to-date: sudo apt-get install nvidia-headless-510.
    – kenorb
    Jun 25 at 12: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. Oct 21, 2016 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.