How to install Gfortran 9, 10 or 11 on Ubuntu

How to install Gfortran 9, 10 or 11 on Ubuntu 20.04 LTS
Linux Shout
October 7, 2021

For Version 10

sudo apt install gfortran-10

For Gfortran Version 11 and other latest one in development:

However, currently while writing the article Gfortran version 11 was not available in the default repository of Ubuntu 20.04. Hence, if you want that then can add a PPA.

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

(followed by)

sudo apt install gfortran-11

On Windows I use gfortran 12 from equation.com. How do you install gfortran 12 on Ubuntu?