Related: Install latest Gfortran on Windows
Gfortran 9 increates support for Fortran 2018 features and has more useful warning messages, particularly if you are currently using Gfortran 7 or older. As with any compiler, newer versions of Gfortran may require recompiling other libraries linked with the Fortran compiler, such as HDF5. On Linux, one can switch between Gfortran compiler versions with update-alternatives.
GCC / Gfortran 9 for Ubuntu 16.04 and newer is available from the Ubuntu-test PPA. Add Ubuntu-test PPA by:
add-apt-repository ppa:ubuntu-toolchain-r/test apt update
Install the most recent Gfortran (similarly for
apt install gfortran-9
Switch between compiler versions with update-alternatives.
If experiencing errors getting any version of
gfortran installed in Ubuntu, try:
A popular alternative for Linux, MacOS and Windows Subsystem for Linux is Homebrew:
brew install gcc