How To Install gcc-gfortran on CentOS 8

gcc-gfortran is Fortran support

Introduction

In this tutorial we learn how to install gcc-gfortran on CentOS 8.

What is gcc-gfortran

The gcc-gfortran package provides support for compiling Fortran programs with the GNU Compiler Collection.

We can use yum or dnf to install gcc-gfortran on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install gcc-gfortran.

Install gcc-gfortran on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install gcc-gfortran using dnf by running the following command:

sudo dnf -y install gcc-gfortran

Install gcc-gfortran on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install gcc-gfortran using yum by running the following command:

sudo yum -y install gcc-gfortran

How To Uninstall gcc-gfortran on CentOS 8

To uninstall only the gcc-gfortran package we can use the following command:

sudo dnf remove gcc-gfortran

gcc-gfortran Package Contents on CentOS 8

/usr/bin/f95
/usr/bin/gfortran
/usr/lib/.build-id
/usr/lib/.build-id/3d
/usr/lib/.build-id/3d/aabaf909d3c934f21200defa00f4822fab23a4
/usr/lib/.build-id/53
/usr/lib/.build-id/53/0f80f45cea4c3add847d0823489a6bca6bddd7
/usr/lib/gcc
/usr/lib/gcc/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/8
/usr/lib/gcc/x86_64-redhat-linux/8/32
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/ieee_arithmetic.mod
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/ieee_exceptions.mod
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/ieee_features.mod
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/omp_lib.f90
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/omp_lib.h
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/omp_lib.mod
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/omp_lib_kinds.mod
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/openacc.f90
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/openacc.mod
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/openacc_kinds.mod
/usr/lib/gcc/x86_64-redhat-linux/8/32/finclude/openacc_lib.h
/usr/lib/gcc/x86_64-redhat-linux/8/32/libcaf_single.a
/usr/lib/gcc/x86_64-redhat-linux/8/32/libgfortran.so
/usr/lib/gcc/x86_64-redhat-linux/8/finclude
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/ieee_arithmetic.mod
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/ieee_exceptions.mod
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/ieee_features.mod
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/omp_lib.f90
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/omp_lib.h
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/omp_lib.mod
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/omp_lib_kinds.mod
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/openacc.f90
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/openacc.mod
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/openacc_kinds.mod
/usr/lib/gcc/x86_64-redhat-linux/8/finclude/openacc_lib.h
/usr/lib/gcc/x86_64-redhat-linux/8/libcaf_single.a
/usr/lib/gcc/x86_64-redhat-linux/8/libgfortran.so
/usr/lib/gcc/x86_64-redhat-linux/8/libgfortran.spec
/usr/lib64/gfortran/modules
/usr/libexec/gcc
/usr/libexec/gcc/x86_64-redhat-linux
/usr/libexec/gcc/x86_64-redhat-linux/8
/usr/libexec/gcc/x86_64-redhat-linux/8/f951
/usr/share/doc/gcc-gfortran
/usr/share/doc/gcc-gfortran/ChangeLog-2002.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2002.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2003.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2003.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2004.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2004.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2005.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2005.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2006.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2006.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2007.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2007.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2008.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2008.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2009.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2009.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2010.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2010.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2011.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2011.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2012.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2012.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2013.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2013.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2014.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2014.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2015.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2015.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2016.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2016.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2017.bz2
/usr/share/doc/gcc-gfortran/ChangeLog-2017.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog.bz2
/usr/share/doc/gcc-gfortran/ChangeLog.libgfortran.bz2
/usr/share/doc/gcc-gfortran/ChangeLog.ptr.bz2
/usr/share/info/gfortran.info.gz
/usr/share/man/man1/gfortran.1.gz

References

Summary

In this tutorial we learn how to install gcc-gfortran on CentOS 8 using yum and dnf.