How to install GNU Fortran on Ubuntu 20.04 / 18.04?

Windows Articles

How to install KVM on Debian 10?

Hello friends, in this post I will show you how to install KVM on Debian 10. KVM stands for...

How to open Windows 10 Mobility Center

Hello! There are many types of users of Windows 10. As it depends on the type of hardware used. That is, the...

Ubuntu 20.04.1 available

Canonical, the company led by Mark Shuttleworth, releases Ubuntu 20.04.1. It has a new image, with updates and security patches for the...

How to install Linux Kernel 5.8 on Ubuntu 20.04?

Upgrading the Linux Kernel can be a beneficial task, but it is always optional. Recently we talked about the Linux Kernel 5.8...

How to activate XPS Viewer in Windows 10

Hey, what's up! When working with Windows 10 we probably use a lot of files. Indeed, these files have many extensions. For...
angeloma
angeloma
Senior Writer and partner

Not everything old is bad. This is how it is. Well, while it is true that there are many programming languages today, there are some that have been a little forgotten as Fortran. However, many companies still need development in this language and not only that but there are tools that have evolved in favor of this language. In this post, I will teach you how to install GNU Fortran on Ubuntu 20.04 / 18.04. This compiler created by GNU is an open source alternative to other compilers that are not.

Fortran is not dead

If we speak mythical programming languages, we will have to talk about Fortran. It is a language focused on numerical calculation, designed in its beginnings for IBM computers and used in scientific and engineering applications and is the oldest of the high-level languages.

Therefore, Fortran was very important in computer science in the last century. You might think that nobody uses it anymore or something does. But the banking sector, in the scientific sector and in other companies that still use this language, pay good amounts of money for experts in the language. It is because of this that many programmers have turned their eyes to Fortran.

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. With the aim of creating a modern compiler capable of running on multiple systems and multiple environments.

The latest version available is version 9. It has many improvements in every Fortran version it supports. You can check the improvements here.

So, let us install GNU Fortran on Ubuntu.

First, open a terminal and add the Ubuntu test repository. This step is only for Ubuntu 18.04.

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

1.- Add the external repository
1.- Add the external repository

Next, refresh the APT cache.

:~$ sudo apt update

Finally, install GNU Fortran 9 by using this command:

:~$ sudo apt install gfortran-9

2.- Install GNU Fortran on Ubuntu 20.04 / 18.04
2.- Install GNU Fortran on Ubuntu 20.04 / 18.04

Then, check the installed version.

:~$ gfortran-9 --version
GNU Fortran (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Now, let us test it. Create a new file called hello.f90. And add the following.

:~$ nano hello.f90
program hello
write(6,*)'Hello world. Welcome to osradar.'
stop
end

Press CTRL + O to save the changes and CTRL + X to close.

After that, compile it using the terminal.

:~$ gfortran-9 -o hello hello.f90

Then, run it.

:~$ ./hello
Hello world! Welcome to Osradar

So, everything is working.

Conclusion

Fortran is a very old programming language. However, there are sectors where it is very important and that is why there are still tools for the language. In this case, we have Fortran and the GNU Fortran compiler.

If you are a developer, you can get more post about programming.

Please share this post with your friends.

More articles

7 COMMENTS

  1. hello dear angeloma.
    Thank you for your very useful guide and really it could help me a lot.
    But I have some more question that you may guide me if is possible.
    is it possible to let me know how can install the Fortran open source in Windows 7 pl? I appreciate if you send me by email. (nikouravan@gmail.com)
    Thank you

  2. Hello Dear Angeloma,
    I am using Pop Os 20.04, which is based on Ubuntu. I am unable to add the test repository. It says that siod-apt-repository command not found. Could you please let me know, how I should proceed from here.
    Thanks!

  3. Hello Dear Angeloma,
    There was a typo in my earlier comment. I meant “sudo-apt-repository command not found”.
    Thanks!

    • This error occurs because the utility is in the software-properties-common package. So, install it.

      sudo apt-get install software-properties-common

      And that’s it.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to install KVM on Debian 10?

Hello friends, in this post I will show you how to install KVM on Debian 10. KVM stands for...

How to open Windows 10 Mobility Center

Hello! There are many types of users of Windows 10. As it depends on the type of hardware used. That is, the...

Ubuntu 20.04.1 available

Canonical, the company led by Mark Shuttleworth, releases Ubuntu 20.04.1. It has a new image, with updates and security patches for the...

How to install Linux Kernel 5.8 on Ubuntu 20.04?

Upgrading the Linux Kernel can be a beneficial task, but it is always optional. Recently we talked about the Linux Kernel 5.8...

How to activate XPS Viewer in Windows 10

Hey, what's up! When working with Windows 10 we probably use a lot of files. Indeed, these files have many extensions. For...