Install gfortran on Rocky Linux

EPEL note

On Rocky Linux the base repositories already carry the Fortran compiler, so most beginners need no extra setup.

The Extra Packages for Enterprise Linux collection exists for extra tools around the compiler. Enable it only when a guide names a package that lives there, otherwise keep the base setup.

Install gcc-gfortran

Install the Fortran compiler package with dnf. The package name on this family is gcc-gfortran.

sudo dnf install gcc-gfortran

Accept the transaction when asked. Dnf pulls in the matching compiler libraries automatically.

Verify with gfortran --version

Ask the compiler for its version number right after the install.

gfortran --version

GNU Fortran 13.2.0

If the version line prints, the compiler is on PATH and ready for the first lessons.

Version notes

Each Rocky Linux major release pins one default compiler version for stability.

Version 9 and newer cover everything used in the first lessons. Stay with the default package unless a lesson asks for a newer standard feature by name.

The code on this page was not run: it needs Rocky Linux and root.

Article author: Arthur Isaev