Some time ago, Debian and Ubuntu changed their security key management architecture. As a result, the procedure for setting up Webmin using a signed repository also changed. Here’s what Webmin developers recommend.
First, set up the Webmin repository by adding the following line into the /etc/apt/sources.list file:
deb https://download.webmin.com/download/repository sarge contrib
Then, run the following commands as root:
cd /root wget https://download.webmin.com/jcameron-key.asc cat jcameron-key.asc | gpg --dearmor > /usr/share/keyrings/jcameron-key.gpg apt-get install apt-transport-https apt-get update apt-get install webmin
On my Ubuntu Server 22.04 LTS, however, this didn’t work; apt-get, when invoked, complained about unsigned Webmin repository and refused to download Webmin. This is because on my installation (and probably on others as well, as mine is pretty generic), apt-get looks for keys not in /usr/share/keyrings, but in /etc/apt/trusted.gpg.d. So the commands that would have worked on my Ubuntu Server are:
cd /root wget https://download.webmin.com/jcameron-key.asc cat jcameron-key.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/jcameron-key.gpg apt-get install apt-transport-https apt-get update apt-get install webmin
The only command that’s different is the third one that starts with cat. The rest is perfectly fine as is.
Alternatively, after doing what Webmin developers suggest and encountering the error, we could simply copy /usr/share/keyrings/jcameron-key.gpg, into /etc/apt/trusted.gpg.d and then run the apt-get commands again… (This is what I ended up doing, since I already had the key on my system, it just needed to be in the right place.)
Even more alternatively, rather than put the key where apt-get expects is to be, we could explicitly tell apt-get where the key actually is. To do that, we would go back to /etc/apt/sources.list and edit the line we added at the beginning of the setup procedure:
deb [signed-by=/usr/share/keyrings/jcameron-key.gpg] https://download.webmin.com/download/repository sarge contrib
This should point apt-get in the right direction…