I've tried using the repository of ubuntu 18.04 for an older version and failed, and now I've tried building 8.7 (the latest version) from source as seems to be the advised way. Also failed. As a completely new user I'm in no position to deal with this problem:
Error building Sage.
The following package(s) may have failed to build (not necessarily during this run of 'make all-build'):
The build directory may contain configuration files and other potentially helpful information. WARNING: if you now run 'make' again, the build directory will, by default, be deleted. Set the environment variable SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.
Makefile:31: recipe for target 'all-build' failed make[1]: * [all-build] Error 1 make[1]: Leaving directory '/home/robert/Sage/sage-8.7' Makefile:16: recipe for target 'build' failed make: * [build] Error 2