Q:

gfortran different versions

In my Ubuntu 18.04 , default gfortran is 7.5. But default gcc version is showing 8.4. I have already installed gfortran-8.4.
I need to make my default gfortran version as 8.4. How to do that?

A:

To install gfortran version 8.4 in Ubuntu 18.04 open the terminal and type:
sudo apt install gfortran-8

You may need to use update-alternatives link to set the gfortran version if you have two or more different versions of gfortran installed. To change the default version of gfortran type:
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-8 60 
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 40 
sudo update-alternatives --config gfortran

