Table of Contents
This tip is about the how to set up Gfortran 9, 10 or 11 in Ubuntu 20.04 LTS. So read this free guide, How to set up Gfortran 9, 10 or 11 in Ubuntu 20.04 LTS. If you have query related to same article you may contact us.
How to set up Gfortran 9, 10 or 11 in Ubuntu 20.04 LTS – Guide
GFortran is the name of the GNU Fortran project. Wikipedia’s main page provides users with many useful links about GFortran as well as Fortran in general. Here, the GFortran installation process on Windows, Linux, macOS and OpenBSD is presented in a beginner-friendly format based on information from GFortranBinaries.
Getting GNU Fortran on Ubuntu 20.04 / 18.04
GNU Fortran is a Fortran 95/003/2008 compiler created by GNU. It is also known on the Internet as GFortran. It is open source, released under the GPL license. Aiming to create a modern compiler capable of working on multiple systems and environments.
The latest version available is 9. It has many improvements in all Fortran versions it supports. You can check the improvements here.
So let’s install GNU Fortran on Ubuntu.
First, open a terminal and add the Ubuntu test repository. This step is for Ubuntu 18.04 only.
: ~ $ sudo add-apt-repository ppa: ubuntu-toolchain-r / test
Then update the APT cache.
: ~ $ sudo apt update
Finally, install GNU Fortran 9 using this command:
: ~ $ sudo apt install gfortran-9
Then check the installed version.
: ~ $ gfortran-9 – version
GNU Fortran (Ubuntu 9.3.0-10ubuntu2) 9.3.0Copyright (C) 2019 Free Software Foundation, Inc.This is free software; consult the source for copying conditions. There is no guarantee; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Now let’s test it. Create a new file called hello.f90. And add the following.
: ~ $ nano hello.f90program hellowrite (6, *) ‘Hello world. Welcome. Stop
Press CTRL + O to save changes and CTRL + X to close.
After that, compile it using the terminal.
: ~ $ gfortran-9 -o hello hello.f90
So run it.
: ~ $ ./helloHello world! Welcome
So everything is working.
Final note
I hope you like the guide How to set up Gfortran 9, 10 or 11 in Ubuntu 20.04 LTS. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.