How to install gfortran on CentOS 7?

How to install the gfortran fortran compiler on CentOS 7 Linux?

gfortran on CentOS 7 is provided in the gcc-gfortran package. You may install it to install gfortran.

# yum install gcc-gfortran
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.cuhk.edu.hk
 * epel: ftp.cuhk.edu.hk
 * extras: centos.01link.hk
 * nux-dextop: li.nux.ro
 * updates: ftp.cuhk.edu.hk
Resolving Dependencies
--> Running transaction check
---> Package gcc-gfortran.x86_64 0:4.8.5-11.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch           Version                 Repository    Size
================================================================================
Installing:
 gcc-gfortran         x86_64         4.8.5-11.el7            base         6.6 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 6.6 M
Installed size: 16 M
Is this ok [y/d/N]: y
Downloading packages:
gcc-gfortran-4.8.5-11.el7.x86_64.rpm                       | 6.6 MB   00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : gcc-gfortran-4.8.5-11.el7.x86_64                             1/1 
  Verifying  : gcc-gfortran-4.8.5-11.el7.x86_64                             1/1 

Installed:
  gcc-gfortran.x86_64 0:4.8.5-11.el7                                            

Complete!

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

3 comments:

  1. This installs a very old version of gfortran (over 3 years and 4 major revisions old). FreeBSD for example provides gfortran8 from 2018 (version 8.2.0), or optionally, the development version gfortran9 version 9.0.0 20180923. How can a Centos 7.5 user install the most up-to-date version of gfortran? Or failing that, a version significantly newer than version 4.8.5?

  2. No package gcc-fortran available.
    Error: Nothing to do

    help me please to install gcc-fortran. For Centos 7, Lenova Core i3.

Leave a Reply

Your email address will not be published. Required fields are marked *