apt.kitware.com: Update repository documentation
Not sure in which project this issue is correct, as it is not just for CMake.
Currently apt.kitware.com tells you, you should do:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates gnupg software-properties-common wget
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main'
sudo apt-get update
It seems this documentation is a bit outdated:
-
software-properties-common depends on
ca-certificates
, so no need to addca-certificates
explicitly -
apt-transport-https
is only necessary on Ubuntu 16.04 -
apt-get update
afterapt-add-repository
is only necessary on Ubuntu 16.04 -
gpg
seems to be preinstalled (at least on all Ubuntu Docker images from 16.04-21.04). Furthermore theregpg
is it's own package, sognupg
(which includes the packagegpg
may not be necessary)
Successful Dockerfile test
Got on all Dockerfiles the latest version of CMake (currently 3.20.2)
20.04, 20.10 & 21.04:
FROM "ubuntu:20.04"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -V install -y software-properties-common wget \
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/nullsoftware-properties-common \
&& apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' \
&& apt-get -V install -y cmake
18.04:
FROM "ubuntu:18.04"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -V install -y software-properties-common wget \
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/nullsoftware-properties-common \
&& apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' \
&& apt-get -V install -y cmake
16.04:
FROM "ubuntu:16.04"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -V install -y apt-transport-https software-properties-common wget \
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/nullsoftware-properties-common \
&& apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main' \
&& apt-get update \
&& apt-get -V install -y cmake
Conclusion
The documentation could be adjusted to:
If you are using a minimal Ubuntu image or a Docker image, you may need to install the following packages:
For Ubuntu Bionic Beaver (18.04) and newer:
sudo apt-get update sudo apt-get install software-properties-common wget
For Ubuntu Xenial Xerus (16.04):
sudo apt-get update sudo apt-get install apt-transport-https software-properties-common wget
Obtain a copy of our signing key:
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
Add the repository to your sources list and update.
For Ubuntu Focal Fossa (20.04):
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main'
For Ubuntu Bionic Beaver (18.04):
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
For Ubuntu Xenial Xerus (16.04):
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main' sudo apt-get update
Same for point 4 and point 5 could get an addition, that this is usually not necessary within a Dockerfile