No fancy GUI is necessary. The base gpg is installed on Ubuntu by default.
gpg --gen-key
Use default type, size and duration.
Enter the name and the email address (I suppose it doesn’t matter which as long as it’s for testing only).
Type O to create the key.
Enter a passphrase twice.
Move your mouse like crazy, but try to spare the effort, it might take long and you’ll get tired. When it’s enough, it will tell you it’s enough. Until it does, keep moving. Don’t stop for long, or you’ll have to repeat the exercise.
The file pubring.gpg will appear in $HOME/.gnupg/
Finally,
sudo apt-key add $HOME/.gnupg/pubring.gpg
Now I can run apt-get update with repos where something is signed with this key.