The Ubuntu 20.04 image appears to come without extra modules, so they need to be installed additionally:
$ sudo apt install linux-modules-extra-$(uname -r)Then simply install zram-config
$ sudo apt install zram-configAnd then reboot.
Verify that zram is working:
cat /proc/swaps
Filename Type Size Used Priority
/dev/zram0 partition 500180 82688 5
If you see the /dev/zramX devices in the output, it worked.