Install NVIDIA Cuda on Ubuntu 18.04 LTS (x86_64)

to install NVIDIA Cuda we need the NVIDIA proprietary driver working (and the libraries and files it provides). Ubuntu and most linux distributions come with the open source driver nouveau, but it is with limited performance and capabilities. For gaming and development you will need the official NVIDIA driver, the SDK and many additional proprietary libraries.
This howto is a sort of continuing the Install NVIDIA proprietary drivers on Ubuntu 18.0 LTS (x86_64) where we install the proprietary driver from the unofficial community driven repository “Graphics Drivers” team. This is Personal Package Archives (PPA) repository! So you should check it, too and be careful about this repository as the maintainers say. For completeness will include all the steps to install the NVIDIA proprietary driver (and for more details for this part just read the specific howto we offer above) and Cuda.

Here are the steps to install NVIDIA CUDA on Ubuntu 18.0 LTS (x86_64) with the help of ppa:graphics-drivers/ppa

STEP 1) Update your current repositories, add the new repository, update again and install the NVIDIA driver with the tool ubuntu-drivers

myuser@srv:~$ sudo apt -y update
myuser@srv:~$ sudo add-apt-repository -y ppa:graphics-drivers/ppa
myuser@srv:~$ sudo apt -y update
myuser@srv:~$ sudo ubuntu-drivers autoinstall
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  build-essential dkms dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-8-base:i386 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4
  libatomic1 libbsd0:i386 libc-dev-bin libc6:i386 libc6-dev libcilkrts5 libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386
  libdrm2:i386 libedit2:i386 libelf1:i386 libexpat1:i386 libfakeroot libffi6:i386 libgcc-7-dev libgcc1:i386 libgl1:i386 libgl1-mesa-dri:i386 libglapi-mesa:i386
  libglvnd0:i386 libglx-mesa0:i386 libglx0:i386 libitm1 libllvm6.0:i386 liblsan0 libmpx2 libnvidia-cfg1-396 libnvidia-common-396 libnvidia-compute-396
  libnvidia-compute-396:i386 libnvidia-decode-396 libnvidia-decode-396:i386 libnvidia-encode-396 libnvidia-encode-396:i386 libnvidia-fbc1-396
  libnvidia-fbc1-396:i386 libnvidia-gl-396 libnvidia-gl-396:i386 libnvidia-ifr1-396 libnvidia-ifr1-396:i386 libpciaccess0:i386 libquadmath0 libsensors4:i386
  libstdc++-7-dev libstdc++6:i386 libtinfo5:i386 libtsan0 libubsan0 libvdpau1 libx11-6:i386 libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386
  libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxnvctrl0
  libxshmfence1:i386 libxxf86vm1:i386 linux-libc-dev make manpages-dev mesa-vdpau-drivers nvidia-compute-utils-396 nvidia-dkms-396 nvidia-kernel-common-396
  nvidia-kernel-source-396 nvidia-prime nvidia-settings nvidia-utils-396 pkg-config screen-resolution-extra vdpau-driver-all xserver-xorg-video-nvidia-396
  zlib1g:i386
Suggested packages:
  menu debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib autoconf automake libtool flex bison gcc-doc gcc-7-multilib
  gcc-7-locales libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg
  libquadmath0-dbg glibc-doc:i386 locales:i386 glibc-doc lm-sensors:i386 libstdc++-7-doc make-doc libvdpau-va-gl1 nvidia-vdpau-driver
  nvidia-legacy-340xx-vdpau-driver
The following NEW packages will be installed:
  build-essential dkms dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-8-base:i386 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4
  libatomic1 libbsd0:i386 libc-dev-bin libc6:i386 libc6-dev libcilkrts5 libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386
  libdrm2:i386 libedit2:i386 libelf1:i386 libexpat1:i386 libfakeroot libffi6:i386 libgcc-7-dev libgcc1:i386 libgl1:i386 libgl1-mesa-dri:i386 libglapi-mesa:i386
  libglvnd0:i386 libglx-mesa0:i386 libglx0:i386 libitm1 libllvm6.0:i386 liblsan0 libmpx2 libnvidia-cfg1-396 libnvidia-common-396 libnvidia-compute-396
  libnvidia-compute-396:i386 libnvidia-decode-396 libnvidia-decode-396:i386 libnvidia-encode-396 libnvidia-encode-396:i386 libnvidia-fbc1-396
  libnvidia-fbc1-396:i386 libnvidia-gl-396 libnvidia-gl-396:i386 libnvidia-ifr1-396 libnvidia-ifr1-396:i386 libpciaccess0:i386 libquadmath0 libsensors4:i386
  libstdc++-7-dev libstdc++6:i386 libtinfo5:i386 libtsan0 libubsan0 libvdpau1 libx11-6:i386 libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386
  libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxnvctrl0
  libxshmfence1:i386 libxxf86vm1:i386 linux-libc-dev make manpages-dev mesa-vdpau-drivers nvidia-compute-utils-396 nvidia-dkms-396 nvidia-driver-396
  nvidia-kernel-common-396 nvidia-kernel-source-396 nvidia-prime nvidia-settings nvidia-utils-396 pkg-config screen-resolution-extra vdpau-driver-all
  xserver-xorg-video-nvidia-396 zlib1g:i386
0 upgraded, 97 newly installed, 0 to remove and 22 not upgraded.
Need to get 145 MB of archives.
After this operation, 743 MB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main amd64 libnvidia-cfg1-396 amd64 396.24.10-0ubuntu0~gpu18.04.1 [71.7 kB]
....
....
myuser@srv:~$ sudo reboot

As you can see the nvidia 396 driver is going to be installed in our system. You can see all the additional (some of which are dependencies) packages to be installed.
After the reboot you should see something similar in your dmesg:

NVIDIA proprietary driver information

myuser@srv:~$ dmesg|grep -i nvidia
[    1.414268] nvidia: loading out-of-tree module taints kernel.
[    1.414273] nvidia: module license 'NVIDIA' taints kernel.
[    1.632334] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[    1.639698] nvidia-nvlink: Nvlink Core is being initialized, major device number 236
[    1.640031] nvidia 0000:0a:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=io+mem
[    1.640146] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  396.24.10  Tue Jul 10 10:00:18 PDT 2018 (using threaded interrupts)
[    1.647029] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  396.24.10  Tue Jul 10 08:53:56 PDT 2018
[    1.648372] [drm] [nvidia-drm] [GPU ID 0x00000a00] Loading driver
[    1.648373] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:0a:00.0 on minor 0
[   37.086767] nvidia-uvm: Loaded the UVM driver in 8 mode, major device number 511
[   37.761570] caller os_map_kernel_space.part.7+0xda/0x120 [nvidia] mapping multiple BARs
[   38.532918] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input16
[   38.532960] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input17
[   38.532996] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input18
[   38.533028] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input19
[   40.851562] caller os_map_kernel_space.part.7+0xda/0x120 [nvidia] mapping multiple BARs
[   41.205592] nvidia-modeset: Allocated GPU:0 (GPU-3bad60bf-8ff7-4cba-8b51-a931299a56d8) @ PCI:0000:0a:00.0

STEP 2) Install NVIDIA CUDA toolkit. As of writing this howto the CUDA 9.1 will be installed.

It depends on GNU GCC 6, but it will automatically pull it as dependencies (you can include it in the install command line as we did).

myuser@srv:~$ sudo apt install -y nvidia-cuda-toolkit gcc-6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  ca-certificates-java cpp-6 fonts-dejavu-extra g++-6 gcc-6-base java-common libaccinj64-9.1 libasan3 libatk-wrapper-java libatk-wrapper-java-jni libcublas9.1
  libcudart9.1 libcufft9.1 libcufftw9.1 libcuinj64-9.1 libcurand9.1 libcusolver9.1 libcusparse9.1 libdrm-dev libgcc-6-dev libgif7 libgl1-mesa-dev libglvnd-core-dev
  libglvnd-dev libnppc9.1 libnppial9.1 libnppicc9.1 libnppicom9.1 libnppidei9.1 libnppif9.1 libnppig9.1 libnppim9.1 libnppist9.1 libnppisu9.1 libnppitc9.1 libnpps9.1
  libnvblas9.1 libnvgraph9.1 libnvrtc9.1 libnvtoolsext1 libnvvm3 libopengl0 libpthread-stubs0-dev libstdc++-6-dev libthrust-dev libvdpau-dev libx11-dev libx11-doc
  libx11-xcb-dev libxau-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev
  libxcb-xfixes0-dev libxcb1-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxshmfence-dev libxxf86vm-dev mesa-common-dev nvidia-cuda-dev nvidia-cuda-doc
  nvidia-cuda-gdb nvidia-opencl-dev nvidia-profiler nvidia-visual-profiler ocl-icd-libopencl1 ocl-icd-opencl-dev opencl-c-headers openjdk-8-jre openjdk-8-jre-headless
  x11proto-core-dev x11proto-damage-dev x11proto-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-xext-dev x11proto-xf86vidmode-dev xorg-sgml-doctools
  xtrans-dev
Suggested packages:
  gcc-6-locales g++-6-multilib gcc-6-doc libstdc++6-6-dbg gcc-6-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan3-dbg liblsan0-dbg libtsan0-dbg
  libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg default-jre libstdc++-6-doc libvdpau-doc libxcb-doc libxext-doc libcupti-dev nvidia-driver libpoclu-dev
  icedtea-8-plugin fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei fonts-wqy-zenhei
Recommended packages:
  libnvcuvid1
The following NEW packages will be installed:
  ca-certificates-java cpp-6 fonts-dejavu-extra g++-6 gcc-6 gcc-6-base java-common libaccinj64-9.1 libasan3 libatk-wrapper-java libatk-wrapper-java-jni libcublas9.1
  libcudart9.1 libcufft9.1 libcufftw9.1 libcuinj64-9.1 libcurand9.1 libcusolver9.1 libcusparse9.1 libdrm-dev libgcc-6-dev libgif7 libgl1-mesa-dev libglvnd-core-dev
  libglvnd-dev libnppc9.1 libnppial9.1 libnppicc9.1 libnppicom9.1 libnppidei9.1 libnppif9.1 libnppig9.1 libnppim9.1 libnppist9.1 libnppisu9.1 libnppitc9.1 libnpps9.1
  libnvblas9.1 libnvgraph9.1 libnvrtc9.1 libnvtoolsext1 libnvvm3 libopengl0 libpthread-stubs0-dev libstdc++-6-dev libthrust-dev libvdpau-dev libx11-dev libx11-doc
  libx11-xcb-dev libxau-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev
  libxcb-xfixes0-dev libxcb1-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxshmfence-dev libxxf86vm-dev mesa-common-dev nvidia-cuda-dev nvidia-cuda-doc
  nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-opencl-dev nvidia-profiler nvidia-visual-profiler ocl-icd-libopencl1 ocl-icd-opencl-dev opencl-c-headers openjdk-8-jre
  openjdk-8-jre-headless x11proto-core-dev x11proto-damage-dev x11proto-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-xext-dev
  x11proto-xf86vidmode-dev xorg-sgml-doctools xtrans-dev
0 upgraded, 90 newly installed, 0 to remove and 25 not upgraded.
Need to get 831 MB of archives.
After this operation, 2005 MB of additional disk space will be used.
Get:1 http://gb.archive.ubuntu.com/ubuntu bionic/main amd64 java-common all 0.63ubuntu1~02 [7032 B]
....
....

done.
done.

You can see all the extra packages you will get – 2G of space is needed and the NVIDIA CUDA 9.1 will be installed (along with GNU GCC 6).

Here you can verify everything is OK:

myuser@srv:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85
myuser@srv:~$ ldconfig -p | grep cuda
        libicudata.so.60 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libicudata.so.60
        libcudart.so.9.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcudart.so.9.1
        libcudart.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcudart.so
        libcuda.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcuda.so.1
        libcuda.so.1 (libc6) => /usr/lib/i386-linux-gnu/libcuda.so.1
        libcuda.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcuda.so
        libcuda.so (libc6) => /usr/lib/i386-linux-gnu/libcuda.so
myuser@srv:~$ nvidia-smi 
Tue Jul 17 14:27:41 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.24.10              Driver Version: 396.24.10                 |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:0A:00.0  On |                  N/A |
|  0%   33C    P8    12W / 275W |    131MiB / 11173MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1696      G   /usr/lib/xorg/Xorg                            59MiB |
|    0      1745      G   /usr/bin/gnome-shell                          69MiB |
+-----------------------------------------------------------------------------+

Install NVIDIA proprietary drivers on Ubuntu 18.0 LTS (x86_64)

The new Ubuntu release is here and as usual it comes with nouveau kernel module for your NVIDIA GPU. Probably this driver is good for everyday office use, but if you like to play games you will need the proprietary driver from NVIDIA for sure! Here are the steps to install the official drivers from NVIDIA with the help of the unofficial community driven repository “Graphics Drivers” team. This is Personal Package Archives (PPA) repository!
DKMS is used for building the NVIDIA kernel module when a new kernel is installed. So you do not have to worry if you update your kernel.
Be careful as it is stated in the repository:

Important: The contents of Personal Package Archives are not checked or monitored. You install software from them at your own risk.

and

You can update your system with unsupported packages from this untrusted PPA by adding …

Still till now no major problems in this repository from its creation and if you just have a home computer and you are a novice in Ubuntu (linux) world you can use this approach of installing NVIDIA proprietary drivers. There is another way of installing the NVIDIA driver from an official source and we are going to cover it soon (coming soon).

STEP 1) Update your system.

Always do this step before installing new software or repositories!

myuser@srv:~$ sudo apt update -y

STEP 2) Add the new repository, which has the nvidia proprietary driver – ppa:graphics-drivers/ppa

myuser@srv:~$ sudo add-apt-repository -y ppa:graphics-drivers/ppa
Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Get:3 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease [21.3 kB]                     
Hit:4 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                   
Get:5 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]                                       
Get:6 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main amd64 Packages [14.1 kB]  
Get:7 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main i386 Packages [13.1 kB]
Get:8 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main Translation-en [4644 B]       
Fetched 211 kB in 1s (302 kB/s)                     
Reading package lists... Done
myuser@srv:~$

STEP 3) Update and install the nvidia driver

As you can see we use a tool for installing drivers under Ubuntu:

ubuntu-drivers

which is part of this package “ubuntu-drivers-common” and it should be installed by default if missing just install it with apt (look below for more information).

myuser@srv:~$ sudo apt -y update
Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Hit:4 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease                
Get:5 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]    
Fetched 158 kB in 1s (273 kB/s)                                                                  
Reading package lists... Done
Building dependency tree       
Reading state information... Done
myuser@srv:~$ sudo ubuntu-drivers autoinstall
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  build-essential dkms dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-8-base:i386 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4
  libatomic1 libbsd0:i386 libc-dev-bin libc6:i386 libc6-dev libcilkrts5 libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386
  libdrm2:i386 libedit2:i386 libelf1:i386 libexpat1:i386 libfakeroot libffi6:i386 libgcc-7-dev libgcc1:i386 libgl1:i386 libgl1-mesa-dri:i386 libglapi-mesa:i386
  libglvnd0:i386 libglx-mesa0:i386 libglx0:i386 libitm1 libllvm6.0:i386 liblsan0 libmpx2 libnvidia-cfg1-396 libnvidia-common-396 libnvidia-compute-396
  libnvidia-compute-396:i386 libnvidia-decode-396 libnvidia-decode-396:i386 libnvidia-encode-396 libnvidia-encode-396:i386 libnvidia-fbc1-396
  libnvidia-fbc1-396:i386 libnvidia-gl-396 libnvidia-gl-396:i386 libnvidia-ifr1-396 libnvidia-ifr1-396:i386 libpciaccess0:i386 libquadmath0 libsensors4:i386
  libstdc++-7-dev libstdc++6:i386 libtinfo5:i386 libtsan0 libubsan0 libvdpau1 libx11-6:i386 libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386
  libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxnvctrl0
  libxshmfence1:i386 libxxf86vm1:i386 linux-libc-dev make manpages-dev mesa-vdpau-drivers nvidia-compute-utils-396 nvidia-dkms-396 nvidia-kernel-common-396
  nvidia-kernel-source-396 nvidia-prime nvidia-settings nvidia-utils-396 pkg-config screen-resolution-extra vdpau-driver-all xserver-xorg-video-nvidia-396
  zlib1g:i386
Suggested packages:
  menu debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib autoconf automake libtool flex bison gcc-doc gcc-7-multilib
  gcc-7-locales libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg
  libquadmath0-dbg glibc-doc:i386 locales:i386 glibc-doc lm-sensors:i386 libstdc++-7-doc make-doc libvdpau-va-gl1 nvidia-vdpau-driver
  nvidia-legacy-340xx-vdpau-driver
The following NEW packages will be installed:
  build-essential dkms dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-8-base:i386 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4
  libatomic1 libbsd0:i386 libc-dev-bin libc6:i386 libc6-dev libcilkrts5 libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386
  libdrm2:i386 libedit2:i386 libelf1:i386 libexpat1:i386 libfakeroot libffi6:i386 libgcc-7-dev libgcc1:i386 libgl1:i386 libgl1-mesa-dri:i386 libglapi-mesa:i386
  libglvnd0:i386 libglx-mesa0:i386 libglx0:i386 libitm1 libllvm6.0:i386 liblsan0 libmpx2 libnvidia-cfg1-396 libnvidia-common-396 libnvidia-compute-396
  libnvidia-compute-396:i386 libnvidia-decode-396 libnvidia-decode-396:i386 libnvidia-encode-396 libnvidia-encode-396:i386 libnvidia-fbc1-396
  libnvidia-fbc1-396:i386 libnvidia-gl-396 libnvidia-gl-396:i386 libnvidia-ifr1-396 libnvidia-ifr1-396:i386 libpciaccess0:i386 libquadmath0 libsensors4:i386
  libstdc++-7-dev libstdc++6:i386 libtinfo5:i386 libtsan0 libubsan0 libvdpau1 libx11-6:i386 libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386
  libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxnvctrl0
  libxshmfence1:i386 libxxf86vm1:i386 linux-libc-dev make manpages-dev mesa-vdpau-drivers nvidia-compute-utils-396 nvidia-dkms-396 nvidia-driver-396
  nvidia-kernel-common-396 nvidia-kernel-source-396 nvidia-prime nvidia-settings nvidia-utils-396 pkg-config screen-resolution-extra vdpau-driver-all
  xserver-xorg-video-nvidia-396 zlib1g:i386
0 upgraded, 97 newly installed, 0 to remove and 22 not upgraded.
Need to get 145 MB of archives.
After this operation, 743 MB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main amd64 libnvidia-cfg1-396 amd64 396.24.10-0ubuntu0~gpu18.04.1 [71.7 kB]
....
....
myuser@srv:~$ sudo reboot

As you can see the nvidia 396 driver is going to be installed in our system. We included part of the output – the packages, which will be installed. When the setup is ready reboot your system to load the newly installed driver.

NVIDIA proprietary driver information

myuser@srv:~$ dmesg|grep -i nvidia
[    1.414268] nvidia: loading out-of-tree module taints kernel.
[    1.414273] nvidia: module license 'NVIDIA' taints kernel.
[    1.632334] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[    1.639698] nvidia-nvlink: Nvlink Core is being initialized, major device number 236
[    1.640031] nvidia 0000:0a:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=io+mem
[    1.640146] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  396.24.10  Tue Jul 10 10:00:18 PDT 2018 (using threaded interrupts)
[    1.647029] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  396.24.10  Tue Jul 10 08:53:56 PDT 2018
[    1.648372] [drm] [nvidia-drm] [GPU ID 0x00000a00] Loading driver
[    1.648373] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:0a:00.0 on minor 0
[   37.086767] nvidia-uvm: Loaded the UVM driver in 8 mode, major device number 511
[   37.761570] caller os_map_kernel_space.part.7+0xda/0x120 [nvidia] mapping multiple BARs
[   38.532918] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input16
[   38.532960] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input17
[   38.532996] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input18
[   38.533028] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input19
[   40.851562] caller os_map_kernel_space.part.7+0xda/0x120 [nvidia] mapping multiple BARs
[   41.205592] nvidia-modeset: Allocated GPU:0 (GPU-3bad60bf-8ff7-4cba-8b51-a931299a56d8) @ PCI:0000:0a:00.0
myuser@srv:~$ nvidia-smi 
Mon Jul 16 15:32:06 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.24.10              Driver Version: 396.24.10                 |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:0A:00.0  On |                  N/A |
|  0%   53C    P0    69W / 275W |    271MiB / 11173MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      2143      G   /usr/lib/xorg/Xorg                            18MiB |
|    0      2193      G   /usr/bin/gnome-shell                          13MiB |
|    0      3593      G   /usr/lib/xorg/Xorg                           108MiB |
|    0      3695      G   /usr/bin/gnome-shell                         123MiB |
|    0      5052      G   nvidia-settings                                3MiB |
+-----------------------------------------------------------------------------+

main menu
nvidia-settings general information

main menu
nvidia-settings for 1080Ti

nouveau driver and vainfo information

myuser@srv:~$ lspci|grep -i nvidia
0a:00.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1)
0a:00.1 Audio device: NVIDIA Corporation GP102 HDMI Audio Controller (rev a1)
myuser@srv:~$ dmesg|grep -i nvidia
[    1.617118] nouveau 0000:0a:00.0: NVIDIA GP102 (132000a1)
[   40.077131] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input16
[   40.077194] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input17
[   40.077234] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input18
[   40.077282] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input19
myuser@srv:~$ sudo apt -y install vainfo mesa-utils
myuser@srv:~$ vainfo 
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nouveau_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc

Troubleshooting – missing “ubuntu-drivers” in your system just install it with:

myuser@srv:~$ sudo apt install -y ubuntu-drivers-common

Install openssh (sshd) server in Ubuntu 18.04 LTS

Yes, new major system upgrade new rules. If you’ve installed openssh server till Ubuntu 18 (Bionic Beaver) with just the simple command:

myuser@srv:~$ sudo apt-get install -y openssh-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package openssh-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'openssh-server' has no installation candidate
myuser@srv:~$

Now it is impossible as you can see. It is strange why they just did not include it as an alias just to prevent you from searching the Net (google?).

So there is a new way of installing OpenSSH server – it is a software collection called “OpenSSH server” and there is a new tool to manage such collections:

tasksel

So you must use tasksel to install OpenSSH server, here is the three command you should use:

sudo apt update
sudo apt install tasksel
sudo tasksel install openssh-server

And their explanation below in steps:

STEP 1) Update your server!

Because you could miss tasksel, it is not installed by default and even after clean install it seems not available before you do an update:

myuser@srv:~$ sudo apt update

STEP 2) Install tasksel

myuser@srv:~$ sudo apt install tasksel

STEP 3) Install OpenSSH server with tasksel

You are going to enter an console based graphic setup showing you the installation of the software collection “OpenSSH server”

myuser@srv:~$ sudo tasksel install openssh-server

Here is what is going to see after the above command:

main menu
tasksel installs openssh-sftp-server

main menu
tasksel installs openssh-server

* Throubleshooting – no tasksel packet!

Just DO NOT skip STEP 1) – update your package lists!!!

myuser@srv:~$ sudo apt install tasksel
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package tasksel

* All of the output