0

So just wondered what happens when I run these commands (specifically on Ubuntu):

# Add NVIDIA package repositories
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.1.243-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804_10.1.243-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt-get update
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt-get update

# Install NVIDIA driver
sudo apt-get install --no-install-recommends nvidia-driver-418
# Reboot. Check that GPUs are visible using the command: nvidia-smi

# Install development and runtime libraries (~4GB)
sudo apt-get install --no-install-recommends \
    cuda-10-1 \
    libcudnn7=7.6.4.38-1+cuda10.1  \
    libcudnn7-dev=7.6.4.38-1+cuda10.1

These are instructions of installing CUDA for Ubuntu, so I have basic understanding of what they do, but commands are unclear to me (apart from wget). What is dpkg, what is apt-key adv --fetch-keys, why we don't add a key from the second repo, but only from the first one, why do we run sudo dpkg -i for the first .deb file and sudo apt install for the second?

It's a general question and has no connection to CUDA specifically, I just want to know more about Linux.

Thanks!

  • In general, if you open a terminal and do man dpkg you will see an explanation of what dpkg is. – K7AAY Jan 23 at 0:45
1

This command download .deb package with CUDA repository information

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.1.243-1_amd64.deb

dpkg is package manager for Debian. Option -i will install previously downloaded package

sudo dpkg -i cuda-repo-ubuntu1804_10.1.243-1_amd64.deb

apt-key is APT key management utility. adv command pass advanced options to gpg.

sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub

.

why do we run sudo dpkg -i for the first .deb file and sudo apt install for the second?

apt is frontend for dpkg. It could resolve dependencies, download and install required package. Probably first .deb file has no dependencies, while second one has.

why we don't add a key from the second repo, but only from the first one

Because they have the same public key

  • Thanks! By the way, when we use dpkg and apt install here, they don’t install packages, they just add them somewhere. As far as I understand, everything is installed in the last line, that is apt-get install, isn’t it? – Denisof Jan 23 at 6:55
  • @Denisof actually they do. Command sudo dpkg -i cuda-repo-ubuntu1804_10.1.243-1_amd64.deb install package that contain apt source list for cuda repository – Slava Kryvel Jan 23 at 21:21
0

why we don't add a key from the second repo, but only from the first one

Because they have the same public key.

curl http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
curl https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub

why do we run sudo dpkg -i for the first .deb file and sudo apt install for the second?

In this case dpkg and apt will setup only a repository, apt have the same effect as dpkg, because the repository setup doesn't require some other dependency to be installed.

Please note that apt is able to solve the dependencies , but dpkg doesn't.

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.