I found two good ways to do it in Ubuntu.
[1] altgr-intl Layout
First one is to put this into the terminal or if you want it permanent into the .bashrc file:
setxkbmap -rules evdev -model evdev -layout us -variant altgr-intl
Afterwards when clicking the right-alt-key/altgr-key the whole keyboard changes into phoentics. Here are the important ones:
altgr+q = ä, altg+Q = Ä
altgr+p = ö, altgr+P = Ö
altgr+y = ü, altgr+Y = Ü
altgr+s = ß
Press buttons at the same time.
Problems:
- there seems to be only one ß (no ẞ)
- might not work, when altgr button is set to be the compose button
- need to learn shortcuts
[2] Set a compose button
A second way is to set a compose button.
Install Ubuntu Tweaks sudo apt-get install gnome-tweaks and start it. Click on Keyboard and Mouse and on Compose Key. Activate it and select a button you like, for example right-alt.
Now you can do:
compose key + " + a = ä
compose key + " + A = Ä
compose key + " + u = ü
compose key + " + U = Ü
compose key + " + o = ö
compose key + " + O = Ö
compose key + ss = ß
compose key + SS = ẞ
Press buttons after each other.
Problems: