Celeb Glow
general | March 25, 2026

How to Install fortran on Ubuntu? [duplicate]

So, I am just starting out to learn Fortran programming. I am a complete newcomer to programming. I have little experience with Ubuntu. What are the recommended ways to install Fortran on Ubuntu?

0

3 Answers

For Fortran alone, you can use

sudo apt-get install gfortran

But even if it takes more space, it is useful to have

sudo apt install build-essential

This installs several other capabilities, including gcc, g++ and make.

You may also want to install the manual pages about using GNU/Linux for development:

sudo apt-get install manpages-dev

First, update the deb repositories using

sudo apt-get update

sudo apt-get upgrade

Then type

sudo apt-get install gfortran

This will install everything needed for programming in FORTRAN.

This is not a direct answer to your question. However, for small test programs and exercises, you can also use one of the many online Fortran compilers. I specifically like the online gfortran compiler by tutorialspoint.com:

because they give you the option to set the compiler/linker flags by yourself. I have also directly asked them to set the default Fortran standard to Fortran 2018 (+ GNU Fortran extention) so that the user is automatically able to use all the new features of Fortran 2003/2008/2018.