If you’re anything like me, and you go for bleeding edge releases to see what they’re like, there can be some drawbacks. The biggest being there is close to no updated documentation when trying to install common packages. I decided to give Debian 12 a try after not using Debian since version 3. I was told there have been some great updates and decided to give it a go. If you, like myself and many others, copy and paste commands from documentation without really reading it, this article is for you.
With Debian 12 I’m using
apt instead of
apt-get. This is why all my commands differ from those found in the Google Cloud documentation. The problem is the commands provided in the documentation don’t work.
Install Google Cloud CLI
Prepare the installation
sudo apt update
sudo apt install apt-transport-https ca-certificates gnupg curl
Add the package source
sudo echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
Import the Google Cloud public key
The docs say to run the following command to add the Cloud SDK distribution URI as a package source, but gives you a warning due to deprecation.
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo tee /usr/share/keyrings/cloud.google.gpg
After some googling, I found that
apt-key has been deprecated in favour of managing keys in
/etc/apt/trustd.gpg.d I thought I could just copy the GPG file into this directory. I was wrong. This will result in the following error.
The key(s) in the keyring /etc/apt/trusted.gpg.d/cloud.google.gpg are ignored as the file has an unsupported filetype.
We need to convert the GPG file to the correct format. To do that, we can use
gpg --dearmor. Let’s update the command so that it works correctly.
sudo curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/cloud.google.gpg
Update and install
sudo apt update && sudo apt install google-cloud-cli
This took me far too long to find the answers, as I haven’t been an apt or Debian user for many years. I hope this helps someone save a few minutes when they’re trying to get their shiny new Debian 12 installation working for the dev and dev-ops environment.